### Run MCP Server with .env file (stdio) Source: https://developer.magiclane.com/docs/guides/mcp-server/usage-guidelines Start the Magic Lane MCP Server using the stdio transport. Copy the example .env file, set your API key, and run the start script. This is suitable for MCP-native clients. ```bash # Using .env file cp .env.example .env npm start # Or with environment variable MAGICLANE_API_KEY=your_api_key npm start ``` -------------------------------- ### Add Optimization Example Source: https://developer.magiclane.com/docs/cloud-rest-api/examples/create-optimization/add-optimization This example shows the structure of an optimization object, including details for multiple customers. ```json { "type": 0, "status": 0, "state": 1, "priority": 0, "numberOfPackages": 9, "weight": 16.2, "cube": 0.4, "revenue": 7.5, "timeWindow": [ 480, 1086 ], "serviceTime": 0, "depotId": 0 }, { "id": 879883, "creationTimestamp": 1778431233370, "customerInfo": { "id": 1791100, "alias": "Customer 6", "firstName": "Customer6", "lastName": "Customer6", "address": { "country": "", "state": "", "county": "", "city": "", "postalCode": "", "streetName": "", "streetNumber": "" }, "email": "customer6@example.com", "phoneNumber": "+12025550185", "location": [ 48.89258, 2.081645 ], "customData": "" }, "location": [ 48.89258, 2.081645 ], "alias": "Customer 6", "firstName": "Customer6", "lastName": "Customer6", "address": { "country": "", "state": "", "county": "", "city": "", "postalCode": "", "streetName": "", "streetNumber": "" }, "phoneNumber": "+12025550185", "customData": "", "type": 1, "status": 0, "state": 1, "priority": 0, "numberOfPackages": 9, "weight": 13.5, "cube": 1.7, "revenue": 10, "timeWindow": [ 350, 1053 ], "serviceTime": 0, "depotId": 0 }, { "id": 879882, "creationTimestamp": 1778431233370, "customerInfo": { "id": 1791099, "alias": "Customer 7", "firstName": "Customer7", "lastName": "Customer7", "address": { "country": "", "state": "", "county": "", "city": "", "postalCode": "", "streetName": "", "streetNumber": "" }, "email": "customer7@example.com", "phoneNumber": "+12025550186", "location": [ 48.891779, 2.149101 ], "customData": "" }, "location": [ 48.891779, 2.149101 ], "alias": "Customer 7", "firstName": "Customer7", "lastName": "Customer7", "address": { "country": "", "state": "", "county": "", "city": "", "postalCode": "", "streetName": "", "streetNumber": "" }, "phoneNumber": "+12025550186", "customData": "", "type": 0, "status": 0, "state": 1, "priority": 0, "numberOfPackages": 5, "weight": 7.5, "cube": 1.2, "revenue": 13.4, "timeWindow": [ 540, 1020 ], "serviceTime": 0, "depotId": 0 }, { "id": 879881, "creationTimestamp": 1778431233370, "customerInfo": { "id": 1791098, "alias": "Customer 8", "firstName": "Customer8", "lastName": "Customer8", "address": { "country": "", "state": "", "county": "", "city": "", "postalCode": "", "streetName": "", "streetNumber": "" }, "email": "customer8@example.com", "phoneNumber": "+12025550187", "location": [ 48.86921, 2.283707 ], "customData": "" }, "location": [ 48.86921, 2.283707 ], "alias": "Customer 8", "firstName": "Customer8", "lastName": "Customer8", "address": { "country": "", "state": "", "county": "", "city": "", "postalCode": "", "streetName": "", "streetNumber": "" }, "phoneNumber": "+12025550187", "customData": "", "type": 1, "status": 0, "state": 1, "priority": 0, "numberOfPackages": 11, "weight": 12.1, "cube": 0.6, "revenue": 14.7, "timeWindow": [ 500, 1086 ], "serviceTime": 0, "depotId": 0 }, { "id": 879880, "creationTimestamp": 1778431233370, "customerInfo": { "id": 1791097, "alias": "Customer 9", "firstName": "Customer9", "lastName": "Customer9", ``` -------------------------------- ### Example Configuration Parameters JSON Source: https://developer.magiclane.com/docs/cloud-rest-api/guides/fleet-management/core-concepts/configuration-parameters This JSON object demonstrates a sample configuration for a route optimization, including parameters like name, ignoreTimeWindow, allowDroppingOrders, and optimization settings. ```json { "configurationParameters": { "name": "Test Optimization", "ignoreTimeWindow": false, "allowDroppingOrders": true, "groupingOrders": false, "balancedRoutes": 0, "optimizationCriterion": 1, "arrangeCriterion": 0, "optimizationQuality": 2, "maxTimeToOptimize": 600, "maxWaitTime": 18000, "routeType": 0, "restrictions": 0, "distanceUnit": 0, "orderSequenceOptions": [] } } ``` -------------------------------- ### Depot Data Example Source: https://developer.magiclane.com/docs/cloud-rest-api/examples/create-optimization/add-orders-to-optimization This example shows the structure for depot data, which is essential for defining starting and ending points for routes in an optimization. ```json { "depotId": 0, "alias": "Depot 1", ``` -------------------------------- ### Reoptimize Optimization Example Source: https://developer.magiclane.com/docs/cloud-rest-api/examples/create-optimization/reoptimize-optimization This example demonstrates how to reoptimize an existing optimization. It includes sample customer data with various attributes like location, time windows, and package details. ```json { "alias": "Customer 14", "firstName": "Customer14", "lastName": "Customer14", "address": { "country": "", "state": "", "county": "", "city": "", "postalCode": "", "streetName": "", "streetNumber": "" }, "phoneNumber": "+120255501813", "customData": "", "type": 0, "status": 0, "state": 1, "priority": 0, "numberOfPackages": 5, "weight": 2.3, "cube": 0.2, "revenue": 5.2, "timeWindow": [ 540, 1020 ], "serviceTime": 0, "depotId": 0 }, { "creationTimestamp": 1778431181222, "customerInfo": { "alias": "Customer 15", "firstName": "Customer15", "lastName": "Customer15", "address": { "country": "", "state": "", "county": "", "city": "", "postalCode": "", "streetName": "", "streetNumber": "" }, "email": "customer15@example.com", "phoneNumber": "+120255501814", "location": [ 48.873694, 2.358232 ], "customData": "" }, "location": [ 48.873694, 2.358232 ], "alias": "Customer 15", "firstName": "Customer15", "lastName": "Customer15", "address": { "country": "", "state": "", "county": "", "city": "", "postalCode": "", "streetName": "", "streetNumber": "" }, "phoneNumber": "+120255501814", "customData": "", "type": 1, "status": 0, "state": 1, "priority": 0, "numberOfPackages": 3, "weight": 2.1, "cube": 0.3, "revenue": 6.3, "timeWindow": [ 500, 1086 ], "serviceTime": 0, "depotId": 0 }, { "creationTimestamp": 1778431181222, "customerInfo": { "alias": "Customer 16", "firstName": "Customer16", "lastName": "Customer16", "address": { "country": "", "state": "", "county": "", "city": "", "postalCode": "", "streetName": "", "streetNumber": "" }, "email": "customer16@example.com", "phoneNumber": "+120255501815", "location": [ 48.800876, 2.047703 ], "customData": "" }, "location": [ 48.800876, 2.047703 ], "alias": "Customer 16", "firstName": "Customer16", "lastName": "Customer16", "address": { "country": "", "state": "", "county": "", "city": "", "postalCode": "", "streetName": "", "streetNumber": "" }, "phoneNumber": "+120255501815", "customData": "", "type": 1, "status": 0, "state": 1, "priority": 0, "numberOfPackages": 1, "weight": 3.3, "cube": 0.1, "revenue": 8, "timeWindow": [ 380, 1070 ], "serviceTime": 0, "depotId": 0 }, { "creationTimestamp": 1778431181222, "customerInfo": { "alias": "Customer 17", "firstName": "Customer17", "lastName": "Customer17", "address": { "country": "", "state": "", "county": "", "city": "", "postalCode": "", "streetName": "", "streetNumber": "" }, "email": "customer17@example.com", "phoneNumber": "+120255501816", "location": [ 48.828673, 1.954428 ], "customData": "" }, "location": [ 48.828673, 1.954428 ], "alias": "Customer 17", "firstName": "Customer17", "lastName": "Customer17", "address": { "country": "", "state": "", "county": "", "city": "", "postalCode": "", "streetName": "", "streetNumber": "" }, "phoneNumber": "+120255501816", "customData": "", "type": 0, "status": 0, "state": 1, "priority": 0, "numberOfPackages": 4, "weight": 1.4, "cube": 0.4, "revenue": 4.8, "timeWindow": [ 400, 1053 ], "serviceTime": 0 } ``` -------------------------------- ### Get Request by ID Response Body Source: https://developer.magiclane.com/docs/cloud-rest-api/guides/fleet-management/core-concepts/request Example response body for retrieving a specific request by its ID. This example shows a route request, indicated by the presence of 'routeId'. ```json { "id": 23567, "routeId": 46587, "status": 0, "message": "Operation done successfully!", "creationTimestamp": 1747786578 } ``` ```json { "id": 0, "routeId": 0, "status": 0, "message": "string", "creationTimestamp": 0 } ``` -------------------------------- ### API Authentication Example Source: https://developer.magiclane.com/docs/cloud-rest-api/guides/geofences-asset-monitoring/introduction Demonstrates how to authenticate API requests using an API key in the Authorization header. Ensure to replace YOUR_API_KEY with your actual key. ```bash curl -X POST https://api.magiclane.net/api/v1/ \ -H "Authorization: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -H "Accept: application/json" ``` -------------------------------- ### Vehicle Constraints JSON Example Source: https://developer.magiclane.com/docs/cloud-rest-api/guides/fleet-management/core-concepts/vehicle-constraints This JSON example demonstrates how to configure vehicle constraints for route optimization, including fuel price, start date, package limits, order counts, distance, and revenue. ```json { "vehicleConstraints": [ { "fuelPrice": 1.09, "startDate": 1596758400000, "maxNumberOfPackages": 53, "minNumberOfOrders": 0, "maxNumberOfOrders": 300, "minDistance": 0, "maxDistance": 800, "maxRevenue": 85 } ] } ``` -------------------------------- ### Configuration Parameters Example Source: https://developer.magiclane.com/docs/cloud-rest-api/guides/fleet-management/core-concepts/customer Sets parameters for route optimization, including name, optimization criteria, and time limits. ```json { "name": "Paris - test optimization", "ignoreTimeWindow": false, "allowDroppingOrders": false, "groupingOrders": false, "balancedRoutes": 0, "optimizationCriterion": 0, "arrangeCriterion": 0, "optimizationQuality": 2, "maxTimeToOptimize": 300, "maxWaitTime": 18000, "routeType": 0, "restrictions": 0, "distanceUnit": 0, "orderSequenceOptions": [] } ``` -------------------------------- ### Get Vehicles API Response Sample Source: https://developer.magiclane.com/docs/cloud-rest-api/api/fleet-management-api.html Example of a successful response when retrieving vehicle data. Includes detailed attributes for a single vehicle. ```json [ { "id": 123456, "type": 0, "name": "string", "maxLoadWeight": 99.5, "maxLoadCube": 99.5, "startTime": 540, "endTime": 1000, "availableBreaks": [ { "duration": 1800, "timeWindows": [ [ 480, 540 ] ] } ], "licensePlate": "string", "status": -1, "lastPosition": [ 45.652871, 25.585588 ], "make": "string", "model": "string", "fuelType": 0, "consumption": 99.5, "bikerWeight": 99.5, "bikePower": 99.5, "height": 99.5, "width": 99.5, "weight": 99.5, "length": 99.5, "axleLoad": 99.5 } ] ``` -------------------------------- ### Reoptimize Optimization Example Source: https://developer.magiclane.com/docs/cloud-rest-api/examples/create-optimization/reoptimize-optimization This example demonstrates how to reoptimize an existing optimization. It includes sample customer and departure data that can be used to update the optimization. Ensure all required fields are populated correctly. ```json { "customers": [ { "creationTimestamp": 1778431181222, "customerInfo": { "alias": "Customer 18", "firstName": "Customer18", "lastName": "Customer18", "address": { "country": "", "state": "", "county": "", "city": "", "postalCode": "", "streetName": "", "streetNumber": "" }, "email": "customer18@example.com", "phoneNumber": "+120255501817", "location": [ 48.870529, 1.966413 ], "customData": "" }, "location": [ 48.870529, 1.966413 ], "alias": "Customer 18", "firstName": "Customer18", "lastName": "Customer18", "address": { "country": "", "state": "", "county": "", "city": "", "postalCode": "", "streetName": "", "streetNumber": "" }, "phoneNumber": "+120255501817", "customData": "", "type": 1, "status": 0, "state": 1, "priority": 0, "numberOfPackages": 8, "weight": 1.8, "cube": 1.7, "revenue": 15.4, "timeWindow": [ 430, 1020 ], "serviceTime": 0, "depotId": 0 }, { "creationTimestamp": 1778431181222, "customerInfo": { "alias": "Customer 19", "firstName": "Customer19", "lastName": "Customer19", "address": { "country": "", "state": "", "county": "", "city": "", "postalCode": "", "streetName": "", "streetNumber": "" }, "email": "customer19@example.com", "phoneNumber": "+120255501818", "location": [ 48.885094, 2.298155 ], "customData": "" }, "location": [ 48.885094, 2.298155 ], "alias": "Customer 19", "firstName": "Customer19", "lastName": "Customer19", "address": { "country": "", "state": "", "county": "", "city": "", "postalCode": "", "streetName": "", "streetNumber": "" }, "phoneNumber": "+120255501818", "customData": "", "type": 0, "status": 0, "state": 1, "priority": 0, "numberOfPackages": 5, "weight": 1.3, "cube": 1.2, "revenue": 16.2, "timeWindow": [ 430, 1020 ], "serviceTime": 0, "depotId": 0 }, { "creationTimestamp": 1778431181222, "customerInfo": { "alias": "Customer 20", "firstName": "Customer20", "lastName": "Customer20", "address": { "country": "", "state": "", "county": "", "city": "", "postalCode": "", "streetName": "", "streetNumber": "" }, "email": "customer20@example.com", "phoneNumber": "+120255501819", "location": [ 48.970061, 2.199346 ], "customData": "" }, "location": [ 48.970061, 2.199346 ], "alias": "Customer 20", "firstName": "Customer20", "lastName": "Customer20", "address": { "country": "", "state": "", "county": "", "city": "", "postalCode": "", "streetName": "", "streetNumber": "" }, "phoneNumber": "+120255501819", "customData": "", "type": 0, "status": 0, "state": 1, "priority": 0, "numberOfPackages": 3, "weight": 3.5, "cube": 0.6, "revenue": 29.1, "timeWindow": [ 435, 1020 ], "serviceTime": 0, "depotId": 0 } ], "departures": [ { "depotId": 0, "alias": "Depot 1", "location": [ 48.850315, 2.326157 ], "address": { "country": "France", "state": "Ile-de-France", "county": "Paris", "city": "Paris", "postalCode": "75001", "streetName": "Rue de Rivoli", "streetNumber": "1" } }, { "depotId": 0, "alias": "Depot 2", "location": [ 8.826995, 2.13394 ], "address": { "country": "France", "state": "Ile-de-France", "county": "Paris", "city": "Paris", "postalCode": "75001", "streetName": "Rue de Rivoli", "streetNumber": "1" } } ] } ``` -------------------------------- ### Get Trip by ID Request Payload Source: https://developer.magiclane.com/docs/cloud-rest-api/api/geofences-asset-monitoring-api.html Example JSON payload for the get_trip_by_id endpoint. Ensure the 'p_trip_id' field is correctly populated with the trip identifier. ```json { "p_trip_id": "delivery_trip_001" } ``` -------------------------------- ### Get Customer by ID Response Example Source: https://developer.magiclane.com/docs/cloud-rest-api/guides/fleet-management/core-concepts/customer This JSON shows a successful response when retrieving a single customer by their ID. It includes the detailed information for that specific customer. ```json { "id": 1838721, "alias": "Magic Customer", "firstName": "Magic", "lastName": "Customer", "address": { "country": "France", "state": "Île-de-France", "county": "Paris", "city": "Paris", "postalCode": "75010", "streetName": "Rue Gustave Goublier", "streetNumber": "2", "extra": "" }, "email": "magiccustomer@example.com", "phoneNumber": "+1202555018", "location": [ 48.870852, 2.356148 ], "customData": "" } ``` -------------------------------- ### Reoptimize Optimization Example Source: https://developer.magiclane.com/docs/cloud-rest-api/examples/create-optimization/reoptimize-optimization This example demonstrates how to reoptimize an existing optimization. It includes sample data for multiple customers with their respective details, locations, and delivery windows. This data can be used to update or re-run an optimization. ```json { "id": 879881, "creationTimestamp": 1778431181222, "customerInfo": { "id": 1791098, "alias": "Customer 8", "firstName": "Customer8", "lastName": "Customer8", "address": { "country": "", "state": "", "county": "", "city": "", "postalCode": "", "streetName": "", "streetNumber": "" }, "email": "customer8@example.com", "phoneNumber": "+12025550187", "location": [ 48.86921, 2.283707 ], "customData": "" }, "location": [ 48.86921, 2.283707 ], "alias": "Customer 8", "firstName": "Customer8", "lastName": "Customer8", "address": { "country": "", "state": "", "county": "", "city": "", "postalCode": "", "streetName": "", "streetNumber": "" }, "phoneNumber": "+12025550187", "customData": "", "type": 1, "status": 0, "state": 1, "priority": 0, "numberOfPackages": 11, "weight": 12.1, "cube": 0.6, "revenue": 14.7, "timeWindow": [ 500, 1086 ], "serviceTime": 0, "depotId": 0 } ``` ```json { "id": 879880, "creationTimestamp": 1778431181222, "customerInfo": { "id": 1791097, "alias": "Customer 9", "firstName": "Customer9", "lastName": "Customer9", "address": { "country": "", "state": "", "county": "", "city": "", "postalCode": "", "streetName": "", "streetNumber": "" }, "email": "customer9@example.com", "phoneNumber": "+12025550188", "location": [ 48.897715, 2.324124 ], "customData": "" }, "location": [ 48.897715, 2.324124 ], "alias": "Customer 9", "firstName": "Customer9", "lastName": "Customer9", "address": { "country": "", "state": "", "county": "", "city": "", "postalCode": "", "streetName": "", "streetNumber": "" }, "phoneNumber": "+12025550188", "customData": "", "type": 1, "status": 0, "state": 1, "priority": 0, "numberOfPackages": 6, "weight": 5.2, "cube": 1.5, "revenue": 2.9, "timeWindow": [ 380, 1070 ], "serviceTime": 0, "depotId": 0 } ``` ```json { "id": 879879, "creationTimestamp": 1778431181222, "customerInfo": { "id": 1791096, "alias": "Customer 10", "firstName": "Customer10", "lastName": "Customer10", "address": { "country": "", "state": "", "county": "", "city": "", "postalCode": "", "streetName": "", "streetNumber": "" }, "email": "customer10@example.com", "phoneNumber": "+12025550189", "location": [ 48.802124, 2.157246 ], "customData": "" }, "location": [ 48.802124, 2.157246 ], "alias": "Customer 10", "firstName": "Customer10", "lastName": "Customer10", "address": { "country": "", "state": "", "county": "", "city": "", "postalCode": "", "streetName": "", "streetNumber": "" }, "phoneNumber": "+12025550189", "customData": "", "type": 0, "status": 0, "state": 1, "priority": 0, "numberOfPackages": 13, "weight": 6.3, "cube": 0.5, "revenue": 8.1, "timeWindow": [ 400, 1053 ], "serviceTime": 0, "depotId": 0 } ``` ```json { "streetNumber": "", "phoneNumber": "+12025550186", "customData": "", "type": 0, "status": 0, "state": 1, "priority": 0, "numberOfPackages": 5, "weight": 7.5, "cube": 1.2, "revenue": 13.4, "timeWindow": [ 540, 1020 ], "serviceTime": 0, "depotId": 0 } ``` -------------------------------- ### Reoptimize Optimization Example Source: https://developer.magiclane.com/docs/cloud-rest-api/examples/create-optimization/reoptimize-optimization This example demonstrates how to reoptimize an existing optimization by providing updated customer and vehicle data. Ensure all required fields are populated correctly. ```json { "optimizationId": 879881, "optimizationParameters": { "depotId": 0, "timeWindow": [ 430, 1036 ], "serviceTime": 0, "numberOfPackages": 8, "weight": 15.4, "cube": 0.8, "revenue": 2.7 }, "customers": [ { "id": 1791101, "alias": "Customer 5", "firstName": "Customer5", "lastName": "Customer5", "address": { "country": "", "state": "", "county": "", "city": "", "postalCode": "", "streetName": "", "streetNumber": "" }, "email": "customer5@example.com", "phoneNumber": "+12025550184", "location": [ 48.928086, 2.217675 ], "customData": "" }, { "id": 1791100, "alias": "Customer 6", "firstName": "Customer6", "lastName": "Customer6", "address": { "country": "", "state": "", "county": "", "city": "", "postalCode": "", "streetName": "", "streetNumber": "" }, "email": "customer6@example.com", "phoneNumber": "+12025550185", "location": [ 48.89258, 2.081645 ], "customData": "" }, { "id": 1791099, "alias": "Customer 7", "firstName": "Customer7", "lastName": "Customer7", "address": { "country": "", "state": "", "county": "", "city": "", "postalCode": "", "streetName": "", "streetNumber": "" }, "email": "customer7@example.com", "phoneNumber": "+12025550186", "location": [ 48.891779, 2.149101 ], "customData": "" } ], "vehicles": [ { "id": 879884, "creationTimestamp": 1778431181222, "customerInfo": { "id": 1791101, "alias": "Customer 5", "firstName": "Customer5", "lastName": "Customer5", "address": { "country": "", "state": "", "county": "", "city": "", "postalCode": "", "streetName": "", "streetNumber": "" }, "email": "customer5@example.com", "phoneNumber": "+12025550184", "location": [ 48.928086, 2.217675 ], "customData": "" }, "location": [ 48.928086, 2.217675 ], "alias": "Customer 5", "firstName": "Customer5", "lastName": "Customer5", "address": { "country": "", "state": "", "county": "", "city": "", "postalCode": "", "streetName": "", "streetNumber": "" }, "phoneNumber": "+12025550184", "customData": "", "type": 0, "status": 0, "state": 1, "priority": 0, "numberOfPackages": 9, "weight": 16.2, "cube": 0.4, "revenue": 7.5, "timeWindow": [ 480, 1086 ], "serviceTime": 0, "depotId": 0 }, { "id": 879883, "creationTimestamp": 1778431181222, "customerInfo": { "id": 1791100, "alias": "Customer 6", "firstName": "Customer6", "lastName": "Customer6", "address": { "country": "", "state": "", "county": "", "city": "", "postalCode": "", "streetName": "", "streetNumber": "" }, "email": "customer6@example.com", "phoneNumber": "+12025550185", "location": [ 48.89258, 2.081645 ], "customData": "" }, "location": [ 48.89258, 2.081645 ], "alias": "Customer 6", "firstName": "Customer6", "lastName": "Customer6", "address": { "country": "", "state": "", "county": "", "city": "", "postalCode": "", "streetName": "", "streetNumber": "" }, "phoneNumber": "+12025550185", "customData": "", "type": 1, "status": 0, "state": 1, "priority": 0, "numberOfPackages": 9, "weight": 13.5, "cube": 1.7, "revenue": 10, "timeWindow": [ 350, 1053 ], "serviceTime": 0, "depotId": 0 }, { "id": 879882, "creationTimestamp": 1778431181222, "customerInfo": { "id": 1791099, "alias": "Customer 7", "firstName": "Customer7", "lastName": "Customer7", "address": { "country": "", "state": "", "county": "", "city": "", "postalCode": "", "streetName": "", "streetNumber": "" }, "email": "customer7@example.com", "phoneNumber": "+12025550186", "location": [ 48.891779, 2.149101 ], "customData": "" }, "location": [ 48.891779, 2.149101 ], "alias": "Customer 7", "firstName": "Customer7", "lastName": "Customer7", "address": { "country": "", "state": "", "county": "", "city": "", "postalCode": "", "streetName": "", "streetNumber": "" }, "phoneNumber": "+12025550186", "customData": "", "type": 1, "status": 0, "state": 1, "priority": 0, "numberOfPackages": 8, "weight": 15.4, "cube": 0.8, "revenue": 2.7, "timeWindow": [ 430, 1036 ], "serviceTime": 0, "depotId": 0 } ] } ``` -------------------------------- ### Example Vehicle Constraints Source: https://developer.magiclane.com/docs/cloud-rest-api/guides/fleet-management/core-concepts/landmark This JSON structure specifies constraints for vehicles, such as the start date, maximum number of packages, minimum/maximum orders, minimum/maximum distance, and maximum revenue. ```json { "startDate": 1596758400000, "maxNumberOfPackages": 53, "minNumberOfOrders": 0, "maxNumberOfOrders": 99999999, "minDistance": 0, "maxDistance": 99999999, "maxRevenue": 85 } ``` -------------------------------- ### Get Customer by ID Schema Example Source: https://developer.magiclane.com/docs/cloud-rest-api/guides/fleet-management/core-concepts/customer This JSON defines the schema for a single customer object, used when retrieving a specific customer by their ID. It details the expected fields and their types. ```json { "id": 0, "alias": "string", "firstName": "string", "lastName": "string", "address": { "country": "string", "state": "string", "county": "string", "city": "string", "postalCode": "string", "streetName": "string", "streetNumber": "string", "extra": "string" }, "email": "string", "phoneNumber": "string", "location": [ 0, 0 ], "customData": "string" } ``` -------------------------------- ### Initial Optimization Data Example Source: https://developer.magiclane.com/docs/cloud-rest-api/examples/create-optimization/update-optimization This snippet shows the initial structure of an optimization object, including details for the first customer and their associated delivery information. ```json { "streetNumber": "" }, "phoneNumber": "+12025550186", "customData": "", "type": 0, "status": 0, "state": 1, "priority": 0, "numberOfPackages": 5, "weight": 7.5, "cube": 1.2, "revenue": 13.4, "timeWindow": [ 540, 1020 ], "serviceTime": 0, "depotId": 0 } ``` -------------------------------- ### Second Depot Data Example Source: https://developer.magiclane.com/docs/cloud-rest-api/examples/create-optimization/update-optimization This snippet shows data for a second depot, useful for scenarios involving multiple starting or ending points. It includes location and address information. ```json { "depotId": 0, "alias": "Depot 2", "location": [ 8.826995, 2.13394 ], "address": { "country": "France", "state": "Ile-de-France", "county": "Paris", "city": "Paris", "postalCode": "75001", "streetName": "Rue de Rivoli", "streetNumber": "1" } } ``` -------------------------------- ### Get Proximity Geofences Response Body Source: https://developer.magiclane.com/docs/cloud-rest-api/guides/geofences-asset-monitoring/geofences-api This is an example of a successful response when querying for nearby geofences. It includes geofence IDs, names, and the distance to the border, indicating whether the point is inside or outside. ```json [ { "id": "employee_parking_lot", "name": "Employee Parking Area", "contains_point": false, "distance_to_border": -415.75 }, { "id": "parking_lot_area", "name": "Employee Parking Zone (Circular)", "contains_point": false, "distance_to_border": -416.34 } ] ``` -------------------------------- ### Third Customer Data Example Source: https://developer.magiclane.com/docs/cloud-rest-api/examples/create-optimization/update-optimization This snippet presents another customer's data, showcasing different package counts, weights, and time windows. It's useful for understanding how these parameters affect optimization. ```json { "creationTimestamp": 1778431233265, "customerInfo": { "alias": "Customer 20", "firstName": "Customer20", "lastName": "Customer20", "address": { "country": "", "state": "", "county": "", "city": "", "postalCode": "", "streetName": "", "streetNumber": "" }, "email": "customer20@example.com", "phoneNumber": "+120255501819", "location": [ 48.970061, 2.199346 ], "customData": "" }, "location": [ 48.970061, 2.199346 ], "alias": "Customer 20", "firstName": "Customer20", "lastName": "Customer20", "address": { "country": "", "state": "", "county": "", "city": "", "postalCode": "", "streetName": "", "streetNumber": "" }, "phoneNumber": "+120255501819", "customData": "", "type": 0, "status": 0, "state": 1, "priority": 0, "numberOfPackages": 3, "weight": 3.5, "cube": 0.6, "revenue": 29.1, "timeWindow": [ 435, 1020 ], "serviceTime": 0, "depotId": 0 } ``` -------------------------------- ### Get Order by ID - Successful Response Example Source: https://developer.magiclane.com/docs/cloud-rest-api/guides/fleet-management/core-concepts/order This JSON object represents a successful response when retrieving an order by its ID. It includes all details of the order, such as customer information, timestamps, location, and status. ```json { "id": 879887, "creationTimestamp": 1778431207621, "customerInfo": { "id": 1838721, "alias": "Magic Customer", "firstName": "Magic", "lastName": "Customer", "address": { "country": "", "state": "", "county": "", "city": "", "postalCode": "", "streetName": "", "streetNumber": "" }, "email": "magiccustomer@example.com", "phoneNumber": "+1202555018", "location": [ 48.870852, 2.356148 ], "customData": "" }, "location": [ 48.870852, 2.356148 ], "alias": "Magic Order", "firstName": "Magic", "lastName": "Order", "address": { "country": "", "state": "", "county": "", "city": "", "postalCode": "", "streetName": "", "streetNumber": "" }, "phoneNumber": "+1202555018", "customData": "", "type": 0, "status": 0, "state": 1, "priority": 0, "numberOfPackages": 3, "weight": 5.1, "cube": 2.5, "revenue": 12, "timeWindow": [ 420, 1086 ], "serviceTime": 0, "depotId": 0 } ``` -------------------------------- ### Reoptimize Optimization Example Source: https://developer.magiclane.com/docs/cloud-rest-api/examples/create-optimization/reoptimize-optimization This example demonstrates how to reoptimize an existing optimization. It shows the structure of the request body, including the optimization ID and the updated parameters. ```json { "optimizationId": "YOUR_OPTIMIZATION_ID", "optimizationParameters": { "alias": "Customer 11", "firstName": "Customer11", "lastName": "Customer11", "address": { "country": "", "state": "", "county": "", "city": "", "postalCode": "", "streetName": "", "streetNumber": "" }, "email": "customer11@example.com", "phoneNumber": "+120255501810", "location": [ 48.772667, 2.150946 ], "customData": "" } } ```