{"openapi":"3.1.0","info":{"title":"Route & Delivery Optimisation API","version":"1.0.0","description":"TSP and capacitated/time-window VRP, pickup-delivery, multi-day plans, territory clustering, depot location, ETAs, load sequencing, driver assignment, slot capacity, geofences and polyline codec — pure computation on caller matrices or coordinates. Paid with x402 exact USDC on Base. No account is required.","contact":{"email":"support@brainiac.software"},"x-guidance":"BRAINIAC.software is a pay-per-call API for software agents. No account or API key is required.\nPayment uses x402 with exact USDC on Base (8453). Each paid resource accepts POST for the call; unpaid GET/HEAD return the same 402 payment challenge for discovery.\nHow to call an operation:\n1. POST JSON matching the requestBody. An unpaid POST (including empty body) returns 402 payment terms before body validation.\n2. Compare 402 payTo, asset, and network with /api/v1/catalog and /.well-known/x402 — not only with the 402 itself.\n3. Pay and retry with payment-signature. Invalid JSON/schema after payment-signature returns 400 and is not charged. Settlement (a charge) only on 2xx. payment-signature attached ≠ charged.\nIdempotency-Key: 64 hex chars from 32 random bytes. Reuse only for the same operation and body (replays stored response, including status=partial). A new key runs a fresh call.\nIdempotency after errors: unpaid 402 does not store the key. Post-signature 402/503 release it (retry same key). Pre-reserve schema 400 does not store it. Other post-signature responses (2xx/4xx/5xx) are stored: same key+body replays; different body → 409. Stored 4xx/5xx replays are not a second charge. Prefer a new key after fixing a 4xx; after 5xx reuse the same key only for the stored error.\nPost-signature 402/503 include prior-payment-attempt (nonce, settled false|unknown). A facilitator 502 is SETTLEMENT_UNKNOWN (stored under the Idempotency-Key; cross-instance replay needs the shared store; may already be charged) — check USDC authorizationState(payer, nonce) on Base before re-signing.\nSettlement signal: settled 2xx include payment-response. 4xx/5xx do not. Do not book a cost from payment-signature alone.\nCoverage billing: HTTP 200 with status complete, partial, or failed is charged at the full listed price. Retrying missing checks needs a new settled call. 4xx/5xx are not charged.\nmissing_items.reason: timeout/rate_limited → one delayed retry (new key); upstream_down → after recovery; not_supported → never.\nInvariants: any missing_items ⇒ not status complete; sources[] is provenance only (source, url, retrievedAt), never success/error keyed by check.\nFree lookup: GET /api/v1/results/{result_id} returns stored coverage JSON (404 RESULT_NOT_FOUND if unknown/expired; not a 402). Prior-Result-Id sets replaces_result_id.\nOutputs are prechecks/drafts for human review — not official determinations, legal advice, or certified filings."},"servers":[{"url":"https://www.brainiac.software"}],"paths":{"/api/v1/route-optimization/distance-matrix":{"post":{"operationId":"great_circle_distance_and_duration_matrix","summary":"Great-circle distance and duration matrix","description":"Build a haversine distance and estimated duration matrix from caller coordinates with optional circuity and speed.","tags":["route-optimization"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"locations":{"minItems":1,"maxItems":500,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"lat":{"type":"number","minimum":-90,"maximum":90},"lon":{"type":"number","minimum":-180,"maximum":180}},"required":["id","lat","lon"],"additionalProperties":false}},"circuity":{"type":"number","minimum":1,"maximum":3},"speedKph":{"type":"number","exclusiveMinimum":0},"speedMps":{"type":"number","exclusiveMinimum":0}},"required":["locations"],"additionalProperties":false},"example":{"locations":[{"id":"london","lat":51.5074,"lon":-0.1278},{"id":"paris","lat":48.8566,"lon":2.3522}],"circuity":1,"speedKph":80}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. For coverage operations, HTTP 200 is used for status complete, partial, and failed; all three settle and are charged at the full listed price. A settled 2xx includes a payment-response response header (facilitator settlement receipt; may include a transaction reference). Conditional fields depend on the result and data-source availability.","headers":{"payment-response":{"description":"Present on settled 2xx only. Facilitator settlement receipt for the x402 payment (not present on 4xx/5xx, which are not charged).","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"string"}},"distancesM":{"type":"array","items":{"type":"array","items":{"type":"number"}}},"durationsS":{"type":"array","items":{"type":"array","items":{"type":"number"}}},"estimate":{"type":"boolean"},"sources":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string"},"url":{"type":"string"},"retrievedAt":{"type":"string"},"status":{"type":"string"}},"additionalProperties":true},"description":"Provenance only (source, url, retrievedAt). Not keyed by check id and does not carry success or error. A check in missing_items does not remove its upstream from sources[]; unavailability is only in missing_items (and unavailable findings)."},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"ids":["london","paris"],"distancesM":[[0,343557],[343557,0]],"durationsS":[[0,15460],[15460,0]],"estimate":true,"sources":[{"source":"Caller-supplied coordinates or distance/duration matrices processed locally","url":"https://www.brainiac.software/api/v1/route-optimization","retrievedAt":"2026-11-14","status":"ok"}],"limitations":["Haversine with IUGG mean radius 6,371,008.8 m; duration = distance / (speedKph/3.6), rounded to whole metres/seconds.","Outputs are route and delivery calculations for human review. They are not legal, customs, tax, medical or identity det…","…"]}}}},"400":{"description":"Invalid JSON or request schema. Not charged (no payment-response). If this 400 is returned before the Idempotency-Key is reserved, the key is not stored — fix the body and you may reuse the key. If an operation-path 400 was stored after a payment-signature was attached, the same key + same body replays it; the same key + a different body returns 409."},"402":{"description":"Payment required. The JSON body is the x402 PaymentRequired object. An unpaid 402 does not store the Idempotency-Key. A 402 after payment-signature releases the key and includes prior-payment-attempt (nonce, settled false|unknown). Not charged; no payment-response. Before re-signing after a post-signature 402, check USDC authorizationState(payer, nonce) on Base."},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Same key with a different body after a stored result returns conflict. Reusing the key cannot trigger a second charge. Not charged when settlement did not occur."},"413":{"description":"Request body exceeds the 24 MB limit. Not charged."},"500":{"description":"Operation failed before settlement, so no payment is taken (no payment-response). The error is stored: reuse the same Idempotency-Key and body to retrieve it without paying again. Use a new key for a fresh attempt with a new payment-signature."},"502":{"description":"Facilitator verify/settle transport failure (often timeout). After payment-signature this is returned as SETTLEMENT_UNKNOWN with prior-payment-attempt; the outcome is stored under the Idempotency-Key. With the shared store configured, other instances replay it instead of settling again; without it, each instance keeps its own memory. The authorization may already be settled on-chain — do not re-sign until USDC authorizationState(payer, nonce) on Base is false."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run. Not charged; no payment-response. A 503 after payment-signature releases the Idempotency-Key and includes prior-payment-attempt."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.02"},"protocols":[{"x402":{"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}],"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}},"/api/v1/route-optimization/tsp-optimize":{"post":{"operationId":"travelling_salesman_route_order","summary":"Travelling salesman route order","description":"Find a best visiting order for one vehicle (closed tour or open path) with fixed start and optional fixed end using Held-Karp or local search.","tags":["route-optimization"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"locations":{"minItems":2,"maxItems":2000,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"x":{"type":"number"},"y":{"type":"number"},"lat":{"type":"number","minimum":-90,"maximum":90},"lon":{"type":"number","minimum":-180,"maximum":180}},"required":["id"],"additionalProperties":false}},"matrix":{"type":"object","properties":{"distances":{"minItems":1,"maxItems":2000,"type":"array","items":{"type":"array","items":{"type":"number"}}},"durations":{"minItems":1,"maxItems":2000,"type":"array","items":{"type":"array","items":{"type":"number"}}}},"required":["distances"],"additionalProperties":false},"matrixFromPoints":{"type":"string","enum":["euclidean","haversine"]},"circuity":{"type":"number","minimum":1,"maximum":3},"speedMps":{"type":"number","exclusiveMinimum":0},"speed":{"type":"number","exclusiveMinimum":0},"start":{"type":"string","minLength":1,"maxLength":120},"end":{"anyOf":[{"type":"string","minLength":1,"maxLength":120},{"type":"null"}]},"objective":{"type":"string","enum":["distance","duration"]},"timeLimitMs":{"type":"integer","minimum":1,"maximum":25000}},"required":["locations","start"],"additionalProperties":false},"example":{"locations":[{"id":"depot","x":0,"y":0},{"id":"s1","x":2,"y":6},{"id":"s2","x":5,"y":2},{"id":"s3","x":6,"y":6},{"id":"s4","x":8,"y":3},{"id":"s5","x":1,"y":3},{"id":"s6","x":4,"y":8}],"matrixFromPoints":"euclidean","start":"depot","end":"depot","objective":"distance","timeLimitMs":2000}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. For coverage operations, HTTP 200 is used for status complete, partial, and failed; all three settle and are charged at the full listed price. A settled 2xx includes a payment-response response header (facilitator settlement receipt; may include a transaction reference). Conditional fields depend on the result and data-source availability.","headers":{"payment-response":{"description":"Present on settled 2xx only. Facilitator settlement receipt for the x402 payment (not present on 4xx/5xx, which are not charged).","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"sequence":{"type":"array","items":{"type":"string"}},"totalDistance":{"type":"number"},"totalDuration":{"type":"number"},"method":{"type":"string"},"optimal":{"type":"boolean"},"estimate":{"type":"boolean"},"timeLimitMs":{"type":"number"},"sources":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string"},"url":{"type":"string"},"retrievedAt":{"type":"string"},"status":{"type":"string"}},"additionalProperties":true},"description":"Provenance only (source, url, retrievedAt). Not keyed by check id and does not carry success or error. A check in missing_items does not remove its upstream from sources[]; unavailability is only in missing_items (and unavailable findings)."},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"sequence":["depot","s2","…"],"totalDistance":24.1344033126,"totalDuration":24.1344033126,"method":"held_karp","optimal":true,"estimate":true,"timeLimitMs":2000,"sources":[{"source":"Caller-supplied coordinates or distance/duration matrices processed locally","url":"https://www.brainiac.software/api/v1/route-optimization","retrievedAt":"2026-11-14","status":"ok"}],"limitations":["TSP ≤ 12 stops uses Held-Karp; larger instances use nearest neighbour + Or-opt/2-opt with timeLimitMs.","Caps: 2,000 stops.","…"]}}}},"400":{"description":"Invalid JSON or request schema. Not charged (no payment-response). If this 400 is returned before the Idempotency-Key is reserved, the key is not stored — fix the body and you may reuse the key. If an operation-path 400 was stored after a payment-signature was attached, the same key + same body replays it; the same key + a different body returns 409."},"402":{"description":"Payment required. The JSON body is the x402 PaymentRequired object. An unpaid 402 does not store the Idempotency-Key. A 402 after payment-signature releases the key and includes prior-payment-attempt (nonce, settled false|unknown). Not charged; no payment-response. Before re-signing after a post-signature 402, check USDC authorizationState(payer, nonce) on Base."},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Same key with a different body after a stored result returns conflict. Reusing the key cannot trigger a second charge. Not charged when settlement did not occur."},"413":{"description":"Request body exceeds the 24 MB limit. Not charged."},"500":{"description":"Operation failed before settlement, so no payment is taken (no payment-response). The error is stored: reuse the same Idempotency-Key and body to retrieve it without paying again. Use a new key for a fresh attempt with a new payment-signature."},"502":{"description":"Facilitator verify/settle transport failure (often timeout). After payment-signature this is returned as SETTLEMENT_UNKNOWN with prior-payment-attempt; the outcome is stored under the Idempotency-Key. With the shared store configured, other instances replay it instead of settling again; without it, each instance keeps its own memory. The authorization may already be settled on-chain — do not re-sign until USDC authorizationState(payer, nonce) on Base is false."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run. Not charged; no payment-response. A 503 after payment-signature releases the Idempotency-Key and includes prior-payment-attempt."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.05"},"protocols":[{"x402":{"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}],"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}},"/api/v1/route-optimization/vrp-capacitated":{"post":{"operationId":"capacitated_vehicle_routing","summary":"Capacitated vehicle routing","description":"Assign stops to vehicles under capacity (and optional duration) limits, returning routes with loads and distances.","tags":["route-optimization"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"depot":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"x":{"type":"number"},"y":{"type":"number"},"lat":{"type":"number","minimum":-90,"maximum":90},"lon":{"type":"number","minimum":-180,"maximum":180}},"required":["id"],"additionalProperties":false},"stops":{"minItems":1,"maxItems":2000,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"x":{"type":"number"},"y":{"type":"number"},"lat":{"type":"number","minimum":-90,"maximum":90},"lon":{"type":"number","minimum":-180,"maximum":180},"demand":{"anyOf":[{"type":"number","minimum":0},{"minItems":1,"maxItems":8,"type":"array","items":{"type":"number","minimum":0}}]}},"required":["id","demand"],"additionalProperties":false}},"vehicles":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"capacity":{"anyOf":[{"type":"number","minimum":0},{"minItems":1,"maxItems":8,"type":"array","items":{"type":"number","minimum":0}}]},"start":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"x":{"type":"number"},"y":{"type":"number"},"lat":{"type":"number","minimum":-90,"maximum":90},"lon":{"type":"number","minimum":-180,"maximum":180}},"required":["id"],"additionalProperties":false},"end":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"x":{"type":"number"},"y":{"type":"number"},"lat":{"type":"number","minimum":-90,"maximum":90},"lon":{"type":"number","minimum":-180,"maximum":180}},"required":["id"],"additionalProperties":false}},"required":["id","capacity"],"additionalProperties":false}},"matrix":{"type":"object","properties":{"distances":{"minItems":1,"maxItems":2000,"type":"array","items":{"type":"array","items":{"type":"number"}}},"durations":{"minItems":1,"maxItems":2000,"type":"array","items":{"type":"array","items":{"type":"number"}}}},"required":["distances"],"additionalProperties":false},"matrixFromPoints":{"type":"string","enum":["euclidean","haversine"]},"circuity":{"type":"number","minimum":1,"maximum":3},"speedMps":{"type":"number","exclusiveMinimum":0},"speed":{"type":"number","exclusiveMinimum":0},"maxRouteDuration":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"minimise":{"type":"string","enum":["distance","duration"]},"timeLimitMs":{"type":"integer","minimum":1,"maximum":25000}},"required":["depot","stops","vehicles"],"additionalProperties":false},"example":{"depot":{"id":"depot","x":0,"y":0},"stops":[{"id":"a","x":2,"y":6,"demand":4},{"id":"b","x":5,"y":2,"demand":3},{"id":"c","x":6,"y":6,"demand":5},{"id":"d","x":8,"y":3,"demand":2},{"id":"e","x":1,"y":3,"demand":3},{"id":"f","x":4,"y":8,"demand":4}],"vehicles":[{"id":"v1","capacity":10},{"id":"v2","capacity":10},{"id":"v3","capacity":10}],"matrixFromPoints":"euclidean","maxRouteDuration":null,"minimise":"distance"}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. For coverage operations, HTTP 200 is used for status complete, partial, and failed; all three settle and are charged at the full listed price. A settled 2xx includes a payment-response response header (facilitator settlement receipt; may include a transaction reference). Conditional fields depend on the result and data-source availability.","headers":{"payment-response":{"description":"Present on settled 2xx only. Facilitator settlement receipt for the x402 payment (not present on 4xx/5xx, which are not charged).","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"routes":{"type":"array","items":{"type":["object","string"],"properties":{"vehicle":{"type":"string"},"stops":{"type":"array","items":{"type":"string"}},"load":{"type":"number"},"distance":{"type":"number"},"duration":{"type":"number"}},"additionalProperties":true}},"totalDistance":{"type":"number"},"unassigned":{"type":"array","items":{}},"method":{"type":"string"},"optimal":{"type":"boolean"},"estimate":{"type":"boolean"},"timeLimitMs":{"type":"number"},"sources":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string"},"url":{"type":"string"},"retrievedAt":{"type":"string"},"status":{"type":"string"}},"additionalProperties":true},"description":"Provenance only (source, url, retrievedAt). Not keyed by check id and does not carry success or error. A check in missing_items does not remove its upstream from sources[]; unavailability is only in missing_items (and unavailable findings)."},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"routes":[{"vehicle":"v1","stops":["a","f"],"load":8,"distance":18.0972543551,"duration":18.0972543551},{"vehicle":"v2","stops":["b","d","…"],"load":10,"distance":20.638275117,"duration":20.638275117},"…"],"totalDistance":45.0600847924,"unassigned":[],"method":"exact_enumeration","optimal":true,"estimate":true,"timeLimitMs":2000,"sources":[{"source":"Caller-supplied coordinates or distance/duration matrices processed locally","url":"https://www.brainiac.software/api/v1/route-optimization","retrievedAt":"2026-11-14","status":"ok"}],"limitations":["VRP ≤ 8 stops uses assignment enumeration with per-route Held-Karp; larger instances use Clarke-Wright + local search.","Caps: 2,000 stops, 100 vehicles.","…"]}}}},"400":{"description":"Invalid JSON or request schema. Not charged (no payment-response). If this 400 is returned before the Idempotency-Key is reserved, the key is not stored — fix the body and you may reuse the key. If an operation-path 400 was stored after a payment-signature was attached, the same key + same body replays it; the same key + a different body returns 409."},"402":{"description":"Payment required. The JSON body is the x402 PaymentRequired object. An unpaid 402 does not store the Idempotency-Key. A 402 after payment-signature releases the key and includes prior-payment-attempt (nonce, settled false|unknown). Not charged; no payment-response. Before re-signing after a post-signature 402, check USDC authorizationState(payer, nonce) on Base."},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Same key with a different body after a stored result returns conflict. Reusing the key cannot trigger a second charge. Not charged when settlement did not occur."},"413":{"description":"Request body exceeds the 24 MB limit. Not charged."},"500":{"description":"Operation failed before settlement, so no payment is taken (no payment-response). The error is stored: reuse the same Idempotency-Key and body to retrieve it without paying again. Use a new key for a fresh attempt with a new payment-signature."},"502":{"description":"Facilitator verify/settle transport failure (often timeout). After payment-signature this is returned as SETTLEMENT_UNKNOWN with prior-payment-attempt; the outcome is stored under the Idempotency-Key. With the shared store configured, other instances replay it instead of settling again; without it, each instance keeps its own memory. The authorization may already be settled on-chain — do not re-sign until USDC authorizationState(payer, nonce) on Base is false."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run. Not charged; no payment-response. A 503 after payment-signature releases the Idempotency-Key and includes prior-payment-attempt."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.05"},"protocols":[{"x402":{"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}],"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}},"/api/v1/route-optimization/vrp-time-windows":{"post":{"operationId":"vehicle_routing_with_time_windows","summary":"Vehicle routing with time windows","description":"Route stops under customer time windows, service times, driver shifts and breaks with forward time propagation.","tags":["route-optimization"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"depot":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"x":{"type":"number"},"y":{"type":"number"},"lat":{"type":"number","minimum":-90,"maximum":90},"lon":{"type":"number","minimum":-180,"maximum":180},"window":{"type":"array","prefixItems":[{"type":"number"},{"type":"number"}],"items":false,"minItems":2,"maxItems":2}},"required":["id"],"additionalProperties":false},"stops":{"minItems":1,"maxItems":2000,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"x":{"type":"number"},"y":{"type":"number"},"lat":{"type":"number","minimum":-90,"maximum":90},"lon":{"type":"number","minimum":-180,"maximum":180},"window":{"type":"array","prefixItems":[{"type":"number"},{"type":"number"}],"items":false,"minItems":2,"maxItems":2},"service":{"type":"number","minimum":0},"demand":{"anyOf":[{"type":"number","minimum":0},{"minItems":1,"maxItems":8,"type":"array","items":{"type":"number","minimum":0}}]}},"required":["id","window"],"additionalProperties":false}},"vehicles":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"shift":{"type":"array","prefixItems":[{"type":"number"},{"type":"number"}],"items":false,"minItems":2,"maxItems":2},"breaks":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"window":{"type":"array","prefixItems":[{"type":"number"},{"type":"number"}],"items":false,"minItems":2,"maxItems":2},"duration":{"type":"number","minimum":0}},"required":["window","duration"],"additionalProperties":false}},"capacity":{"anyOf":[{"type":"number","minimum":0},{"minItems":1,"maxItems":8,"type":"array","items":{"type":"number","minimum":0}}]}},"required":["id","shift"],"additionalProperties":false}},"matrix":{"type":"object","properties":{"distances":{"minItems":1,"maxItems":2000,"type":"array","items":{"type":"array","items":{"type":"number"}}},"durations":{"minItems":1,"maxItems":2000,"type":"array","items":{"type":"array","items":{"type":"number"}}}},"required":["distances"],"additionalProperties":false},"matrixFromPoints":{"type":"string","enum":["euclidean","haversine"]},"circuity":{"type":"number","minimum":1,"maximum":3},"speed":{"type":"number","exclusiveMinimum":0},"speedMps":{"type":"number","exclusiveMinimum":0},"minimise":{"type":"string","enum":["distance","completion_time","vehicles"]},"timeLimitMs":{"type":"integer","minimum":1,"maximum":25000}},"required":["depot","stops","vehicles"],"additionalProperties":false},"example":{"depot":{"id":"depot","x":0,"y":0,"window":[0,100]},"stops":[{"id":"a","x":2,"y":6,"window":[25,40],"service":2},{"id":"b","x":5,"y":2,"window":[0,10],"service":2},{"id":"c","x":6,"y":6,"window":[15,30],"service":2},{"id":"d","x":8,"y":3,"window":[5,20],"service":2},{"id":"e","x":1,"y":3,"window":[35,50],"service":2}],"vehicles":[{"id":"v1","shift":[0,100],"breaks":[]}],"matrixFromPoints":"euclidean","speed":1,"minimise":"completion_time"}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. For coverage operations, HTTP 200 is used for status complete, partial, and failed; all three settle and are charged at the full listed price. A settled 2xx includes a payment-response response header (facilitator settlement receipt; may include a transaction reference). Conditional fields depend on the result and data-source availability.","headers":{"payment-response":{"description":"Present on settled 2xx only. Facilitator settlement receipt for the x402 payment (not present on 4xx/5xx, which are not charged).","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"routes":{"type":"array","items":{"type":"object","properties":{"vehicle":{"type":"string"},"stops":{"type":"array","items":{"type":["object","string"],"properties":{"id":{"type":"string"},"arrival":{"type":"number"},"start":{"type":"number"},"wait":{"type":"number"},"departure":{"type":"number"}},"additionalProperties":true}},"end":{"type":"number"},"totalWait":{"type":"number"},"distance":{"type":"number"}},"additionalProperties":true}},"unassigned":{"type":"array","items":{}},"method":{"type":"string"},"optimal":{"type":"boolean"},"estimate":{"type":"boolean"},"timeLimitMs":{"type":"number"},"sources":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string"},"url":{"type":"string"},"retrievedAt":{"type":"string"},"status":{"type":"string"}},"additionalProperties":true},"description":"Provenance only (source, url, retrievedAt). Not keyed by check id and does not carry success or error. A check in missing_items does not remove its upstream from sources[]; unavailability is only in missing_items (and unavailable findings)."},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"routes":[{"vehicle":"v1","stops":[{"id":"b","arrival":5.38516480713,"start":5.38516480713,"wait":0,"departure":7.38516480713},{"id":"d","arrival":10.5474424673,"start":10.5474424673,"wait":0,"departure":12.5474424673},"…"],"end":40.1622776602,"totalWait":7.68472859706,"distance":22.4775490631}],"unassigned":[],"method":"exact_enumeration","optimal":true,"estimate":true,"timeLimitMs":2000,"sources":[{"source":"Caller-supplied coordinates or distance/duration matrices processed locally","url":"https://www.brainiac.software/api/v1/route-optimization","retrievedAt":"2026-11-14","status":"ok"}],"limitations":["Time-window VRP: exact enumeration for small instances; Solomon I1 insertion otherwise.","Outputs are route and delivery calculations for human review. They are not legal, customs, tax, medical or identity det…","…"]}}}},"400":{"description":"Invalid JSON or request schema. Not charged (no payment-response). If this 400 is returned before the Idempotency-Key is reserved, the key is not stored — fix the body and you may reuse the key. If an operation-path 400 was stored after a payment-signature was attached, the same key + same body replays it; the same key + a different body returns 409."},"402":{"description":"Payment required. The JSON body is the x402 PaymentRequired object. An unpaid 402 does not store the Idempotency-Key. A 402 after payment-signature releases the key and includes prior-payment-attempt (nonce, settled false|unknown). Not charged; no payment-response. Before re-signing after a post-signature 402, check USDC authorizationState(payer, nonce) on Base."},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Same key with a different body after a stored result returns conflict. Reusing the key cannot trigger a second charge. Not charged when settlement did not occur."},"413":{"description":"Request body exceeds the 24 MB limit. Not charged."},"500":{"description":"Operation failed before settlement, so no payment is taken (no payment-response). The error is stored: reuse the same Idempotency-Key and body to retrieve it without paying again. Use a new key for a fresh attempt with a new payment-signature."},"502":{"description":"Facilitator verify/settle transport failure (often timeout). After payment-signature this is returned as SETTLEMENT_UNKNOWN with prior-payment-attempt; the outcome is stored under the Idempotency-Key. With the shared store configured, other instances replay it instead of settling again; without it, each instance keeps its own memory. The authorization may already be settled on-chain — do not re-sign until USDC authorizationState(payer, nonce) on Base is false."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run. Not charged; no payment-response. A 503 after payment-signature releases the Idempotency-Key and includes prior-payment-attempt."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.05"},"protocols":[{"x402":{"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}],"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}},"/api/v1/route-optimization/pickup-delivery":{"post":{"operationId":"pickup_and_delivery_routing","summary":"Pickup and delivery routing","description":"Route paired pickup-and-delivery requests with precedence, same-vehicle and capacity constraints.","tags":["route-optimization"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"depot":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"x":{"type":"number"},"y":{"type":"number"},"lat":{"type":"number","minimum":-90,"maximum":90},"lon":{"type":"number","minimum":-180,"maximum":180}},"required":["id"],"additionalProperties":false},"requests":{"minItems":1,"maxItems":2000,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"pickup":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"x":{"type":"number"},"y":{"type":"number"},"lat":{"type":"number","minimum":-90,"maximum":90},"lon":{"type":"number","minimum":-180,"maximum":180}},"required":["id"],"additionalProperties":false},"delivery":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"x":{"type":"number"},"y":{"type":"number"},"lat":{"type":"number","minimum":-90,"maximum":90},"lon":{"type":"number","minimum":-180,"maximum":180}},"required":["id"],"additionalProperties":false},"quantity":{"type":"number","minimum":0}},"required":["id","pickup","delivery","quantity"],"additionalProperties":false}},"vehicles":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"capacity":{"type":"number","minimum":0}},"required":["id","capacity"],"additionalProperties":false}},"matrix":{"type":"object","properties":{"distances":{"minItems":1,"maxItems":2000,"type":"array","items":{"type":"array","items":{"type":"number"}}},"durations":{"minItems":1,"maxItems":2000,"type":"array","items":{"type":"array","items":{"type":"number"}}}},"required":["distances"],"additionalProperties":false},"matrixFromPoints":{"type":"string","enum":["euclidean","haversine"]},"circuity":{"type":"number","minimum":1,"maximum":3},"speed":{"type":"number","exclusiveMinimum":0},"timeLimitMs":{"type":"integer","minimum":1,"maximum":25000}},"required":["depot","requests","vehicles"],"additionalProperties":false},"example":{"depot":{"id":"depot","x":0,"y":0},"requests":[{"id":"r1","pickup":{"id":"p1","x":2,"y":0},"delivery":{"id":"d1","x":4,"y":0},"quantity":1},{"id":"r2","pickup":{"id":"p2","x":0,"y":2},"delivery":{"id":"d2","x":0,"y":4},"quantity":1}],"vehicles":[{"id":"v1","capacity":1}],"matrixFromPoints":"euclidean"}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. For coverage operations, HTTP 200 is used for status complete, partial, and failed; all three settle and are charged at the full listed price. A settled 2xx includes a payment-response response header (facilitator settlement receipt; may include a transaction reference). Conditional fields depend on the result and data-source availability.","headers":{"payment-response":{"description":"Present on settled 2xx only. Facilitator settlement receipt for the x402 payment (not present on 4xx/5xx, which are not charged).","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"routes":{"type":"array","items":{"type":"object","properties":{"vehicle":{"type":"string"},"sequence":{"type":"array","items":{"type":"string"}},"distance":{"type":"number"},"maxLoad":{"type":"number"}},"additionalProperties":true}},"unassigned":{"type":"array","items":{}},"method":{"type":"string"},"optimal":{"type":"boolean"},"estimate":{"type":"boolean"},"sources":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string"},"url":{"type":"string"},"retrievedAt":{"type":"string"},"status":{"type":"string"}},"additionalProperties":true},"description":"Provenance only (source, url, retrievedAt). Not keyed by check id and does not carry success or error. A check in missing_items does not remove its upstream from sources[]; unavailability is only in missing_items (and unavailable findings)."},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"routes":[{"vehicle":"v1","sequence":["depot","p1","…"],"distance":14.472135955,"maxLoad":1}],"unassigned":[],"method":"exact_enumeration","optimal":true,"estimate":true,"sources":[{"source":"Caller-supplied coordinates or distance/duration matrices processed locally","url":"https://www.brainiac.software/api/v1/route-optimization","retrievedAt":"2026-11-14","status":"ok"}],"limitations":["Pickup-before-delivery precedence with same-vehicle and capacity constraints.","Outputs are route and delivery calculations for human review. They are not legal, customs, tax, medical or identity det…","…"]}}}},"400":{"description":"Invalid JSON or request schema. Not charged (no payment-response). If this 400 is returned before the Idempotency-Key is reserved, the key is not stored — fix the body and you may reuse the key. If an operation-path 400 was stored after a payment-signature was attached, the same key + same body replays it; the same key + a different body returns 409."},"402":{"description":"Payment required. The JSON body is the x402 PaymentRequired object. An unpaid 402 does not store the Idempotency-Key. A 402 after payment-signature releases the key and includes prior-payment-attempt (nonce, settled false|unknown). Not charged; no payment-response. Before re-signing after a post-signature 402, check USDC authorizationState(payer, nonce) on Base."},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Same key with a different body after a stored result returns conflict. Reusing the key cannot trigger a second charge. Not charged when settlement did not occur."},"413":{"description":"Request body exceeds the 24 MB limit. Not charged."},"500":{"description":"Operation failed before settlement, so no payment is taken (no payment-response). The error is stored: reuse the same Idempotency-Key and body to retrieve it without paying again. Use a new key for a fresh attempt with a new payment-signature."},"502":{"description":"Facilitator verify/settle transport failure (often timeout). After payment-signature this is returned as SETTLEMENT_UNKNOWN with prior-payment-attempt; the outcome is stored under the Idempotency-Key. With the shared store configured, other instances replay it instead of settling again; without it, each instance keeps its own memory. The authorization may already be settled on-chain — do not re-sign until USDC authorizationState(payer, nonce) on Base is false."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run. Not charged; no payment-response. A 503 after payment-signature releases the Idempotency-Key and includes prior-payment-attempt."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.05"},"protocols":[{"x402":{"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}],"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}},"/api/v1/route-optimization/multi-day-plan":{"post":{"operationId":"multi_day_visit_planning","summary":"Multi-day visit planning","description":"Assign recurring visits across a horizon with frequency and spacing rules, then route each day.","tags":["route-optimization"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"horizonDays":{"minItems":1,"maxItems":28,"type":"array","items":{"type":"string","minLength":1,"maxLength":120}},"stops":{"minItems":1,"maxItems":2000,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"x":{"type":"number"},"y":{"type":"number"},"lat":{"type":"number","minimum":-90,"maximum":90},"lon":{"type":"number","minimum":-180,"maximum":180},"visitsPerWeek":{"type":"integer","minimum":1,"maximum":28},"minGapDays":{"type":"integer","minimum":0,"maximum":28},"allowedDays":{"anyOf":[{"type":"array","items":{"type":"string","minLength":1,"maxLength":120}},{"type":"null"}]},"demand":{"type":"number","minimum":0}},"required":["id","visitsPerWeek"],"additionalProperties":false}},"depot":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"x":{"type":"number"},"y":{"type":"number"},"lat":{"type":"number","minimum":-90,"maximum":90},"lon":{"type":"number","minimum":-180,"maximum":180}},"additionalProperties":false},"vehiclesPerDay":{"type":"integer","minimum":1,"maximum":100},"capacityPerDay":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"matrix":{"type":"object","properties":{"distances":{"minItems":1,"maxItems":2000,"type":"array","items":{"type":"array","items":{"type":"number"}}},"durations":{"minItems":1,"maxItems":2000,"type":"array","items":{"type":"array","items":{"type":"number"}}}},"required":["distances"],"additionalProperties":false},"matrixFromPoints":{"type":"string","enum":["euclidean","haversine"]},"timeLimitMs":{"type":"integer","minimum":1,"maximum":25000}},"required":["horizonDays","stops","depot"],"additionalProperties":false},"example":{"horizonDays":["Mon","Tue","Wed","Thu","Fri"],"stops":[{"id":"s1","x":1,"y":1,"visitsPerWeek":2,"minGapDays":2,"allowedDays":null}],"depot":{"x":0,"y":0},"vehiclesPerDay":1,"capacityPerDay":null,"matrixFromPoints":"euclidean"}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. For coverage operations, HTTP 200 is used for status complete, partial, and failed; all three settle and are charged at the full listed price. A settled 2xx includes a payment-response response header (facilitator settlement receipt; may include a transaction reference). Conditional fields depend on the result and data-source availability.","headers":{"payment-response":{"description":"Present on settled 2xx only. Facilitator settlement receipt for the x402 payment (not present on 4xx/5xx, which are not charged).","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"days":{"type":"array","items":{"type":"object","properties":{"day":{"type":"string"},"route":{"type":"array","items":{"type":"string"}},"distance":{"type":"number"}},"additionalProperties":true}},"visitPatterns":{"type":"array","items":{"type":"object","properties":{"stop":{"type":"string"},"days":{"type":"array","items":{"type":"string"}}},"additionalProperties":true}},"unassigned":{"type":"array","items":{}},"sources":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string"},"url":{"type":"string"},"retrievedAt":{"type":"string"},"status":{"type":"string"}},"additionalProperties":true},"description":"Provenance only (source, url, retrievedAt). Not keyed by check id and does not carry success or error. A check in missing_items does not remove its upstream from sources[]; unavailability is only in missing_items (and unavailable findings)."},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"days":[{"day":"Mon","route":["s1"],"distance":2.82842712475},{"day":"Wed","route":["s1"],"distance":2.82842712475}],"visitPatterns":[{"stop":"s1","days":["Mon","Wed"]}],"unassigned":[],"sources":[{"source":"Caller-supplied coordinates or distance/duration matrices processed locally","url":"https://www.brainiac.software/api/v1/route-optimization","retrievedAt":"2026-11-14","status":"ok"}],"limitations":["Visit patterns honour frequency and minGapDays; each day is routed with the TSP solver.","Outputs are route and delivery calculations for human review. They are not legal, customs, tax, medical or identity det…","…"]}}}},"400":{"description":"Invalid JSON or request schema. Not charged (no payment-response). If this 400 is returned before the Idempotency-Key is reserved, the key is not stored — fix the body and you may reuse the key. If an operation-path 400 was stored after a payment-signature was attached, the same key + same body replays it; the same key + a different body returns 409."},"402":{"description":"Payment required. The JSON body is the x402 PaymentRequired object. An unpaid 402 does not store the Idempotency-Key. A 402 after payment-signature releases the key and includes prior-payment-attempt (nonce, settled false|unknown). Not charged; no payment-response. Before re-signing after a post-signature 402, check USDC authorizationState(payer, nonce) on Base."},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Same key with a different body after a stored result returns conflict. Reusing the key cannot trigger a second charge. Not charged when settlement did not occur."},"413":{"description":"Request body exceeds the 24 MB limit. Not charged."},"500":{"description":"Operation failed before settlement, so no payment is taken (no payment-response). The error is stored: reuse the same Idempotency-Key and body to retrieve it without paying again. Use a new key for a fresh attempt with a new payment-signature."},"502":{"description":"Facilitator verify/settle transport failure (often timeout). After payment-signature this is returned as SETTLEMENT_UNKNOWN with prior-payment-attempt; the outcome is stored under the Idempotency-Key. With the shared store configured, other instances replay it instead of settling again; without it, each instance keeps its own memory. The authorization may already be settled on-chain — do not re-sign until USDC authorizationState(payer, nonce) on Base is false."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run. Not charged; no payment-response. A 503 after payment-signature releases the Idempotency-Key and includes prior-payment-attempt."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.05"},"protocols":[{"x402":{"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}],"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}},"/api/v1/route-optimization/territory-cluster":{"post":{"operationId":"balanced_territory_clustering","summary":"Balanced territory clustering","description":"Split stops into k balanced, compact territories with capacitated k-means and imbalance limits.","tags":["route-optimization"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"stops":{"minItems":1,"maxItems":2000,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"x":{"type":"number"},"y":{"type":"number"},"lat":{"type":"number","minimum":-90,"maximum":90},"lon":{"type":"number","minimum":-180,"maximum":180},"weight":{"type":"number","minimum":0}},"required":["id"],"additionalProperties":false}},"k":{"type":"integer","minimum":1,"maximum":500},"balanceBy":{"type":"string","enum":["count","weight"]},"maxImbalance":{"type":"number","minimum":0,"maximum":1},"matrixFromPoints":{"type":"string","enum":["euclidean","haversine"]},"seed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["stops","k"],"additionalProperties":false},"example":{"stops":[{"id":"1","x":0,"y":0,"weight":1},{"id":"2","x":1,"y":0,"weight":1},{"id":"3","x":0,"y":1,"weight":1},{"id":"4","x":1,"y":1,"weight":1},{"id":"5","x":10,"y":10,"weight":1},{"id":"6","x":11,"y":10,"weight":1},{"id":"7","x":10,"y":11,"weight":1},{"id":"8","x":11,"y":11,"weight":1}],"k":2,"balanceBy":"weight","maxImbalance":0.1,"matrixFromPoints":"euclidean"}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. For coverage operations, HTTP 200 is used for status complete, partial, and failed; all three settle and are charged at the full listed price. A settled 2xx includes a payment-response response header (facilitator settlement receipt; may include a transaction reference). Conditional fields depend on the result and data-source availability.","headers":{"payment-response":{"description":"Present on settled 2xx only. Facilitator settlement receipt for the x402 payment (not present on 4xx/5xx, which are not charged).","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"territories":{"type":"array","items":{"type":"object","properties":{"id":{"type":"number"},"stops":{"type":"array","items":{"type":"string"}},"size":{"type":"number"},"centroid":{"type":"array","items":{"type":"number"}}},"additionalProperties":true}},"imbalance":{"type":"number"},"withinSse":{"type":"number"},"sources":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string"},"url":{"type":"string"},"retrievedAt":{"type":"string"},"status":{"type":"string"}},"additionalProperties":true},"description":"Provenance only (source, url, retrievedAt). Not keyed by check id and does not carry success or error. A check in missing_items does not remove its upstream from sources[]; unavailability is only in missing_items (and unavailable findings)."},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"territories":[{"id":0,"stops":["1","2","…"],"size":4,"centroid":[0.5,0.5]},{"id":1,"stops":["5","6","…"],"size":4,"centroid":[10.5,10.5]}],"imbalance":0,"withinSse":4,"sources":[{"source":"Caller-supplied coordinates or distance/duration matrices processed locally","url":"https://www.brainiac.software/api/v1/route-optimization","retrievedAt":"2026-11-14","status":"ok"}],"limitations":["Capacitated k-means with k-means++ (mulberry32) initialisation and capacity mean×(1±maxImbalance).","Outputs are route and delivery calculations for human review. They are not legal, customs, tax, medical or identity det…","…"]}}}},"400":{"description":"Invalid JSON or request schema. Not charged (no payment-response). If this 400 is returned before the Idempotency-Key is reserved, the key is not stored — fix the body and you may reuse the key. If an operation-path 400 was stored after a payment-signature was attached, the same key + same body replays it; the same key + a different body returns 409."},"402":{"description":"Payment required. The JSON body is the x402 PaymentRequired object. An unpaid 402 does not store the Idempotency-Key. A 402 after payment-signature releases the key and includes prior-payment-attempt (nonce, settled false|unknown). Not charged; no payment-response. Before re-signing after a post-signature 402, check USDC authorizationState(payer, nonce) on Base."},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Same key with a different body after a stored result returns conflict. Reusing the key cannot trigger a second charge. Not charged when settlement did not occur."},"413":{"description":"Request body exceeds the 24 MB limit. Not charged."},"500":{"description":"Operation failed before settlement, so no payment is taken (no payment-response). The error is stored: reuse the same Idempotency-Key and body to retrieve it without paying again. Use a new key for a fresh attempt with a new payment-signature."},"502":{"description":"Facilitator verify/settle transport failure (often timeout). After payment-signature this is returned as SETTLEMENT_UNKNOWN with prior-payment-attempt; the outcome is stored under the Idempotency-Key. With the shared store configured, other instances replay it instead of settling again; without it, each instance keeps its own memory. The authorization may already be settled on-chain — do not re-sign until USDC authorizationState(payer, nonce) on Base is false."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run. Not charged; no payment-response. A 503 after payment-signature releases the Idempotency-Key and includes prior-payment-attempt."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.03"},"protocols":[{"x402":{"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}],"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}},"/api/v1/route-optimization/depot-location-optimize":{"post":{"operationId":"depot_hub_location_p_median","summary":"Depot / hub location (p-median)","description":"Choose p hub locations from candidates to minimise demand-weighted distance, optionally capacitated.","tags":["route-optimization"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"demand":{"minItems":1,"maxItems":20000,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"x":{"type":"number"},"y":{"type":"number"},"lat":{"type":"number","minimum":-90,"maximum":90},"lon":{"type":"number","minimum":-180,"maximum":180},"weight":{"type":"number","minimum":0}},"required":["id","weight"],"additionalProperties":false}},"candidates":{"minItems":1,"maxItems":500,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"x":{"type":"number"},"y":{"type":"number"},"lat":{"type":"number","minimum":-90,"maximum":90},"lon":{"type":"number","minimum":-180,"maximum":180}},"required":["id"],"additionalProperties":false}},"p":{"type":"integer","minimum":1,"maximum":100},"matrix":{"type":"object","properties":{"distances":{"minItems":1,"maxItems":2000,"type":"array","items":{"type":"array","items":{"type":"number"}}},"durations":{"minItems":1,"maxItems":2000,"type":"array","items":{"type":"array","items":{"type":"number"}}}},"required":["distances"],"additionalProperties":false},"matrixFromPoints":{"type":"string","enum":["euclidean","haversine"]},"capacities":{"anyOf":[{"type":"array","items":{"type":"number","minimum":0}},{"type":"null"}]}},"required":["demand","candidates","p"],"additionalProperties":false},"example":{"demand":[{"id":"D1","x":0,"y":0,"weight":10},{"id":"D2","x":1,"y":0,"weight":5},{"id":"D3","x":5,"y":5,"weight":8},{"id":"D4","x":6,"y":5,"weight":4},{"id":"D5","x":10,"y":0,"weight":6},{"id":"D6","x":9,"y":1,"weight":3}],"candidates":[{"id":"C1","x":0,"y":0},{"id":"C2","x":1,"y":1},{"id":"C3","x":5,"y":5},{"id":"C4","x":6,"y":4},{"id":"C5","x":10,"y":0},{"id":"C6","x":3,"y":3}],"p":2,"matrixFromPoints":"euclidean","capacities":null}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. For coverage operations, HTTP 200 is used for status complete, partial, and failed; all three settle and are charged at the full listed price. A settled 2xx includes a payment-response response header (facilitator settlement receipt; may include a transaction reference). Conditional fields depend on the result and data-source availability.","headers":{"payment-response":{"description":"Present on settled 2xx only. Facilitator settlement receipt for the x402 payment (not present on 4xx/5xx, which are not charged).","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"selected":{"type":"array","items":{"type":"string"}},"objective":{"type":"number"},"allocation":{"type":"array","items":{"type":["object","string"],"properties":{"demand":{"type":"string"},"facility":{"type":"string"}},"additionalProperties":true}},"method":{"type":"string"},"optimal":{"type":"boolean"},"sources":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string"},"url":{"type":"string"},"retrievedAt":{"type":"string"},"status":{"type":"string"}},"additionalProperties":true},"description":"Provenance only (source, url, retrievedAt). Not keyed by check id and does not carry success or error. A check in missing_items does not remove its upstream from sources[]; unavailability is only in missing_items (and unavailable findings)."},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"selected":["C1","C4"],"objective":66.9827560573,"allocation":[{"demand":"D1","facility":"C1"},{"demand":"D2","facility":"C1"},"…"],"method":"exhaustive","optimal":true,"sources":[{"source":"Caller-supplied coordinates or distance/duration matrices processed locally","url":"https://www.brainiac.software/api/v1/route-optimization","retrievedAt":"2026-11-14","status":"ok"}],"limitations":["p-median over candidates; exhaustive when C(n,p) ≤ 100,000, otherwise greedy + Teitz-Bart.","Outputs are route and delivery calculations for human review. They are not legal, customs, tax, medical or identity det…","…"]}}}},"400":{"description":"Invalid JSON or request schema. Not charged (no payment-response). If this 400 is returned before the Idempotency-Key is reserved, the key is not stored — fix the body and you may reuse the key. If an operation-path 400 was stored after a payment-signature was attached, the same key + same body replays it; the same key + a different body returns 409."},"402":{"description":"Payment required. The JSON body is the x402 PaymentRequired object. An unpaid 402 does not store the Idempotency-Key. A 402 after payment-signature releases the key and includes prior-payment-attempt (nonce, settled false|unknown). Not charged; no payment-response. Before re-signing after a post-signature 402, check USDC authorizationState(payer, nonce) on Base."},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Same key with a different body after a stored result returns conflict. Reusing the key cannot trigger a second charge. Not charged when settlement did not occur."},"413":{"description":"Request body exceeds the 24 MB limit. Not charged."},"500":{"description":"Operation failed before settlement, so no payment is taken (no payment-response). The error is stored: reuse the same Idempotency-Key and body to retrieve it without paying again. Use a new key for a fresh attempt with a new payment-signature."},"502":{"description":"Facilitator verify/settle transport failure (often timeout). After payment-signature this is returned as SETTLEMENT_UNKNOWN with prior-payment-attempt; the outcome is stored under the Idempotency-Key. With the shared store configured, other instances replay it instead of settling again; without it, each instance keeps its own memory. The authorization may already be settled on-chain — do not re-sign until USDC authorizationState(payer, nonce) on Base is false."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run. Not charged; no payment-response. A 503 after payment-signature releases the Idempotency-Key and includes prior-payment-attempt."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.04"},"protocols":[{"x402":{"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}],"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}},"/api/v1/route-optimization/route-eta-schedule":{"post":{"operationId":"eta_schedule_for_a_fixed_sequence","summary":"ETA schedule for a fixed sequence","description":"Compute arrivals, waits, slack and overtime for a fixed stop sequence with optional return and shift end.","tags":["route-optimization"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"start":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"x":{"type":"number"},"y":{"type":"number"},"lat":{"type":"number","minimum":-90,"maximum":90},"lon":{"type":"number","minimum":-180,"maximum":180},"time":{"type":"number"}},"required":["id"],"additionalProperties":false},"sequence":{"minItems":1,"maxItems":2000,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"x":{"type":"number"},"y":{"type":"number"},"lat":{"type":"number","minimum":-90,"maximum":90},"lon":{"type":"number","minimum":-180,"maximum":180},"window":{"type":"array","prefixItems":[{"type":"number"},{"type":"number"}],"items":false,"minItems":2,"maxItems":2},"service":{"type":"number","minimum":0}},"required":["id"],"additionalProperties":false}},"returnTo":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"x":{"type":"number"},"y":{"type":"number"},"lat":{"type":"number","minimum":-90,"maximum":90},"lon":{"type":"number","minimum":-180,"maximum":180}},"additionalProperties":false},"matrix":{"type":"object","properties":{"distances":{"minItems":1,"maxItems":2000,"type":"array","items":{"type":"array","items":{"type":"number"}}},"durations":{"minItems":1,"maxItems":2000,"type":"array","items":{"type":"array","items":{"type":"number"}}}},"required":["distances"],"additionalProperties":false},"matrixFromPoints":{"type":"string","enum":["euclidean","haversine"]},"speed":{"type":"number","exclusiveMinimum":0},"speedMps":{"type":"number","exclusiveMinimum":0},"shiftEnd":{"type":"number"}},"required":["start","sequence"],"additionalProperties":false},"example":{"start":{"id":"depot","x":0,"y":0,"time":0},"sequence":[{"id":"b","x":5,"y":2,"window":[0,10],"service":2},{"id":"d","x":8,"y":3,"window":[5,20],"service":2},{"id":"c","x":6,"y":6,"window":[15,30],"service":2},{"id":"a","x":2,"y":6,"window":[25,40],"service":2},{"id":"e","x":1,"y":3,"window":[35,50],"service":2}],"returnTo":{"x":0,"y":0},"matrixFromPoints":"euclidean","speed":1,"shiftEnd":100}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. For coverage operations, HTTP 200 is used for status complete, partial, and failed; all three settle and are charged at the full listed price. A settled 2xx includes a payment-response response header (facilitator settlement receipt; may include a transaction reference). Conditional fields depend on the result and data-source availability.","headers":{"payment-response":{"description":"Present on settled 2xx only. Facilitator settlement receipt for the x402 payment (not present on 4xx/5xx, which are not charged).","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"stops":{"type":"array","items":{"type":["object","string"],"properties":{"id":{"type":"string"},"arrival":{"type":"number"},"start":{"type":"number"},"departure":{"type":"number"},"wait":{"type":"number"},"slack":{"type":"number"},"late":{"type":"boolean"},"lateBy":{"type":"number"}},"additionalProperties":true}},"returnTime":{"type":"number"},"overtime":{"type":"number"},"violations":{"type":"array","items":{}},"totalDistance":{"type":"number"},"estimate":{"type":"boolean"},"sources":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string"},"url":{"type":"string"},"retrievedAt":{"type":"string"},"status":{"type":"string"}},"additionalProperties":true},"description":"Provenance only (source, url, retrievedAt). Not keyed by check id and does not carry success or error. A check in missing_items does not remove its upstream from sources[]; unavailability is only in missing_items (and unavailable findings)."},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"stops":[{"id":"b","arrival":5.38516480713,"start":5.38516480713,"departure":7.38516480713,"wait":0,"slack":4.61483519287,"late":false,"lateBy":0},{"id":"d","arrival":10.5474424673,"start":10.5474424673,"departure":12.5474424673,"wait":0,"slack":9.4525575327,"late":false,"lateBy":0},"…"],"returnTime":40.1622776602,"overtime":0,"violations":[],"totalDistance":22.4775490631,"estimate":true,"sources":[{"source":"Caller-supplied coordinates or distance/duration matrices processed locally","url":"https://www.brainiac.software/api/v1/route-optimization","retrievedAt":"2026-11-14","status":"ok"}],"limitations":["Forward ETA pass on a fixed sequence; late stops are flagged, not rejected.","Outputs are route and delivery calculations for human review. They are not legal, customs, tax, medical or identity det…","…"]}}}},"400":{"description":"Invalid JSON or request schema. Not charged (no payment-response). If this 400 is returned before the Idempotency-Key is reserved, the key is not stored — fix the body and you may reuse the key. If an operation-path 400 was stored after a payment-signature was attached, the same key + same body replays it; the same key + a different body returns 409."},"402":{"description":"Payment required. The JSON body is the x402 PaymentRequired object. An unpaid 402 does not store the Idempotency-Key. A 402 after payment-signature releases the key and includes prior-payment-attempt (nonce, settled false|unknown). Not charged; no payment-response. Before re-signing after a post-signature 402, check USDC authorizationState(payer, nonce) on Base."},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Same key with a different body after a stored result returns conflict. Reusing the key cannot trigger a second charge. Not charged when settlement did not occur."},"413":{"description":"Request body exceeds the 24 MB limit. Not charged."},"500":{"description":"Operation failed before settlement, so no payment is taken (no payment-response). The error is stored: reuse the same Idempotency-Key and body to retrieve it without paying again. Use a new key for a fresh attempt with a new payment-signature."},"502":{"description":"Facilitator verify/settle transport failure (often timeout). After payment-signature this is returned as SETTLEMENT_UNKNOWN with prior-payment-attempt; the outcome is stored under the Idempotency-Key. With the shared store configured, other instances replay it instead of settling again; without it, each instance keeps its own memory. The authorization may already be settled on-chain — do not re-sign until USDC authorizationState(payer, nonce) on Base is false."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run. Not charged; no payment-response. A 503 after payment-signature releases the Idempotency-Key and includes prior-payment-attempt."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.02"},"protocols":[{"x402":{"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}],"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}},"/api/v1/route-optimization/vehicle-load-sequence":{"post":{"operationId":"vehicle_loading_order_and_3d_fit","summary":"Vehicle loading order and 3D fit","description":"Order parcels last-delivered-first and run a deterministic layer first-fit packing check in a van or truck box.","tags":["route-optimization"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"box":{"type":"object","properties":{"length":{"type":"number","exclusiveMinimum":0},"width":{"type":"number","exclusiveMinimum":0},"height":{"type":"number","exclusiveMinimum":0},"maxWeight":{"type":"number","exclusiveMinimum":0}},"required":["length","width","height","maxWeight"],"additionalProperties":false},"parcels":{"minItems":1,"maxItems":2000,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"stopIndex":{"type":"integer","minimum":0,"maximum":9007199254740991},"l":{"type":"number","exclusiveMinimum":0},"w":{"type":"number","exclusiveMinimum":0},"h":{"type":"number","exclusiveMinimum":0},"weight":{"type":"number","minimum":0},"rotatable":{"type":"boolean"}},"required":["id","stopIndex","l","w","h","weight"],"additionalProperties":false}},"units":{"type":"string","minLength":1,"maxLength":32}},"required":["box","parcels"],"additionalProperties":false},"example":{"box":{"length":300,"width":170,"height":180,"maxWeight":1000},"parcels":[{"id":"p1","stopIndex":1,"l":60,"w":40,"h":40,"weight":20,"rotatable":true},{"id":"p2","stopIndex":2,"l":60,"w":40,"h":40,"weight":20,"rotatable":true},{"id":"p3","stopIndex":3,"l":60,"w":40,"h":40,"weight":20,"rotatable":true}],"units":"cm_kg"}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. For coverage operations, HTTP 200 is used for status complete, partial, and failed; all three settle and are charged at the full listed price. A settled 2xx includes a payment-response response header (facilitator settlement receipt; may include a transaction reference). Conditional fields depend on the result and data-source availability.","headers":{"payment-response":{"description":"Present on settled 2xx only. Facilitator settlement receipt for the x402 payment (not present on 4xx/5xx, which are not charged).","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"loadingOrder":{"type":"array","items":{"type":"string"}},"fits":{"type":"boolean"},"volumeUtilisation":{"type":"number"},"weightUtilisation":{"type":"number"},"placements":{"type":"array","items":{"type":["object","string"],"properties":{"id":{"type":"string"},"x":{"type":"number"},"y":{"type":"number"},"z":{"type":"number"},"orientation":{"type":"string"}},"additionalProperties":true}},"method":{"type":"string"},"sources":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string"},"url":{"type":"string"},"retrievedAt":{"type":"string"},"status":{"type":"string"}},"additionalProperties":true},"description":"Provenance only (source, url, retrievedAt). Not keyed by check id and does not carry success or error. A check in missing_items does not remove its upstream from sources[]; unavailability is only in missing_items (and unavailable findings)."},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"loadingOrder":["p3","p2","…"],"fits":true,"volumeUtilisation":0.0313725490196,"weightUtilisation":0.06,"placements":[{"id":"p3","x":0,"y":0,"z":0,"orientation":"lwh"},{"id":"p2","x":0,"y":40,"z":0,"orientation":"lwh"},"…"],"method":"layer_first_fit_decreasing","sources":[{"source":"Caller-supplied coordinates or distance/duration matrices processed locally","url":"https://www.brainiac.software/api/v1/route-optimization","retrievedAt":"2026-11-14","status":"ok"}],"limitations":["Loading order is descending stopIndex (last delivered loads first); layer-first-fit with fixed rotation order.","Outputs are route and delivery calculations for human review. They are not legal, customs, tax, medical or identity det…","…"]}}}},"400":{"description":"Invalid JSON or request schema. Not charged (no payment-response). If this 400 is returned before the Idempotency-Key is reserved, the key is not stored — fix the body and you may reuse the key. If an operation-path 400 was stored after a payment-signature was attached, the same key + same body replays it; the same key + a different body returns 409."},"402":{"description":"Payment required. The JSON body is the x402 PaymentRequired object. An unpaid 402 does not store the Idempotency-Key. A 402 after payment-signature releases the key and includes prior-payment-attempt (nonce, settled false|unknown). Not charged; no payment-response. Before re-signing after a post-signature 402, check USDC authorizationState(payer, nonce) on Base."},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Same key with a different body after a stored result returns conflict. Reusing the key cannot trigger a second charge. Not charged when settlement did not occur."},"413":{"description":"Request body exceeds the 24 MB limit. Not charged."},"500":{"description":"Operation failed before settlement, so no payment is taken (no payment-response). The error is stored: reuse the same Idempotency-Key and body to retrieve it without paying again. Use a new key for a fresh attempt with a new payment-signature."},"502":{"description":"Facilitator verify/settle transport failure (often timeout). After payment-signature this is returned as SETTLEMENT_UNKNOWN with prior-payment-attempt; the outcome is stored under the Idempotency-Key. With the shared store configured, other instances replay it instead of settling again; without it, each instance keeps its own memory. The authorization may already be settled on-chain — do not re-sign until USDC authorizationState(payer, nonce) on Base is false."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run. Not charged; no payment-response. A 503 after payment-signature releases the Idempotency-Key and includes prior-payment-attempt."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.03"},"protocols":[{"x402":{"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}],"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}},"/api/v1/route-optimization/driver-shift-assign":{"post":{"operationId":"assign_routes_to_drivers","summary":"Assign routes to drivers","description":"Assign pre-built routes to drivers by shift, skills and vehicle type with min-cost Hungarian matching.","tags":["route-optimization"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"routes":{"minItems":1,"maxItems":500,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"start":{"type":"number"},"end":{"type":"number"},"skills":{"maxItems":50,"type":"array","items":{"type":"string","minLength":1,"maxLength":64}},"vehicleType":{"type":"string","minLength":1,"maxLength":64}},"required":["id","start","end"],"additionalProperties":false}},"drivers":{"minItems":1,"maxItems":500,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"shift":{"type":"array","prefixItems":[{"type":"number"},{"type":"number"}],"items":false,"minItems":2,"maxItems":2},"skills":{"maxItems":50,"type":"array","items":{"type":"string","minLength":1,"maxLength":64}},"vehicleTypes":{"maxItems":50,"type":"array","items":{"type":"string","minLength":1,"maxLength":64}},"cost":{"type":"number","minimum":0}},"required":["id","shift"],"additionalProperties":false}},"skillMode":{"type":"string","enum":["strict","soft"]},"skillPenalty":{"type":"number","minimum":0},"allowMultiple":{"type":"boolean"}},"required":["routes","drivers"],"additionalProperties":false},"example":{"routes":[{"id":"R1","start":480,"end":960,"skills":["hazmat"],"vehicleType":"van"},{"id":"R2","start":420,"end":720,"skills":[],"vehicleType":"van"}],"drivers":[{"id":"D1","shift":[420,1020],"skills":["hazmat"],"vehicleTypes":["van"],"cost":1},{"id":"D2","shift":[400,800],"skills":[],"vehicleTypes":["van"],"cost":1}],"skillMode":"strict"}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. For coverage operations, HTTP 200 is used for status complete, partial, and failed; all three settle and are charged at the full listed price. A settled 2xx includes a payment-response response header (facilitator settlement receipt; may include a transaction reference). Conditional fields depend on the result and data-source availability.","headers":{"payment-response":{"description":"Present on settled 2xx only. Facilitator settlement receipt for the x402 payment (not present on 4xx/5xx, which are not charged).","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"assignments":{"type":"array","items":{"type":"object","properties":{"route":{"type":"string"},"driver":{"type":"string"}},"additionalProperties":true}},"unassigned":{"type":"array","items":{}},"totalCost":{"type":"number"},"sources":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string"},"url":{"type":"string"},"retrievedAt":{"type":"string"},"status":{"type":"string"}},"additionalProperties":true},"description":"Provenance only (source, url, retrievedAt). Not keyed by check id and does not carry success or error. A check in missing_items does not remove its upstream from sources[]; unavailability is only in missing_items (and unavailable findings)."},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"assignments":[{"route":"R1","driver":"D1"},{"route":"R2","driver":"D2"}],"unassigned":[],"totalCost":2,"sources":[{"source":"Caller-supplied coordinates or distance/duration matrices processed locally","url":"https://www.brainiac.software/api/v1/route-optimization","retrievedAt":"2026-11-14","status":"ok"}],"limitations":["Min-cost assignment (Hungarian) with shift, vehicle type and skill filters.","Outputs are route and delivery calculations for human review. They are not legal, customs, tax, medical or identity det…","…"]}}}},"400":{"description":"Invalid JSON or request schema. Not charged (no payment-response). If this 400 is returned before the Idempotency-Key is reserved, the key is not stored — fix the body and you may reuse the key. If an operation-path 400 was stored after a payment-signature was attached, the same key + same body replays it; the same key + a different body returns 409."},"402":{"description":"Payment required. The JSON body is the x402 PaymentRequired object. An unpaid 402 does not store the Idempotency-Key. A 402 after payment-signature releases the key and includes prior-payment-attempt (nonce, settled false|unknown). Not charged; no payment-response. Before re-signing after a post-signature 402, check USDC authorizationState(payer, nonce) on Base."},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Same key with a different body after a stored result returns conflict. Reusing the key cannot trigger a second charge. Not charged when settlement did not occur."},"413":{"description":"Request body exceeds the 24 MB limit. Not charged."},"500":{"description":"Operation failed before settlement, so no payment is taken (no payment-response). The error is stored: reuse the same Idempotency-Key and body to retrieve it without paying again. Use a new key for a fresh attempt with a new payment-signature."},"502":{"description":"Facilitator verify/settle transport failure (often timeout). After payment-signature this is returned as SETTLEMENT_UNKNOWN with prior-payment-attempt; the outcome is stored under the Idempotency-Key. With the shared store configured, other instances replay it instead of settling again; without it, each instance keeps its own memory. The authorization may already be settled on-chain — do not re-sign until USDC authorizationState(payer, nonce) on Base is false."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run. Not charged; no payment-response. A 503 after payment-signature releases the Idempotency-Key and includes prior-payment-attempt."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.03"},"protocols":[{"x402":{"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}],"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}},"/api/v1/route-optimization/delivery-slot-capacity":{"post":{"operationId":"delivery_slot_capacity","summary":"Delivery slot capacity","description":"Estimate bookable orders per zone and time slot from vehicle time, service, drive and stem assumptions.","tags":["route-optimization"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"zones":{"minItems":1,"maxItems":500,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"vehicles":{"type":"integer","minimum":1,"maximum":10000},"avgServiceMin":{"type":"number","minimum":0},"avgDriveBetweenStopsMin":{"type":"number","minimum":0},"stemMin":{"type":"number","minimum":0}},"required":["id","vehicles","avgServiceMin","avgDriveBetweenStopsMin"],"additionalProperties":false}},"slots":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"start":{"type":"string","pattern":"^\\d{2}:\\d{2}$"},"end":{"type":"string","pattern":"^\\d{2}:\\d{2}$"}},"required":["id","start","end"],"additionalProperties":false}},"booked":{"maxItems":50000,"type":"array","items":{"type":"object","properties":{"zone":{"type":"string","minLength":1,"maxLength":120},"slot":{"type":"string","minLength":1,"maxLength":120},"orders":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["zone","slot","orders"],"additionalProperties":false}},"bufferPct":{"type":"number","minimum":0,"maximum":0.9},"stemEverySlot":{"type":"boolean"}},"required":["zones","slots"],"additionalProperties":false},"example":{"zones":[{"id":"Z1","vehicles":2,"avgServiceMin":6,"avgDriveBetweenStopsMin":9,"stemMin":20}],"slots":[{"id":"09-11","start":"09:00","end":"11:00"},{"id":"11-13","start":"11:00","end":"13:00"}],"booked":[{"zone":"Z1","slot":"09-11","orders":10}],"bufferPct":0.1}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. For coverage operations, HTTP 200 is used for status complete, partial, and failed; all three settle and are charged at the full listed price. A settled 2xx includes a payment-response response header (facilitator settlement receipt; may include a transaction reference). Conditional fields depend on the result and data-source availability.","headers":{"payment-response":{"description":"Present on settled 2xx only. Facilitator settlement receipt for the x402 payment (not present on 4xx/5xx, which are not charged).","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"slots":{"type":"array","items":{"type":"object","properties":{"zone":{"type":"string"},"slot":{"type":"string"},"capacityOrders":{"type":"number"},"booked":{"type":"number"},"available":{"type":"number"}},"additionalProperties":true}},"sources":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string"},"url":{"type":"string"},"retrievedAt":{"type":"string"},"status":{"type":"string"}},"additionalProperties":true},"description":"Provenance only (source, url, retrievedAt). Not keyed by check id and does not carry success or error. A check in missing_items does not remove its upstream from sources[]; unavailability is only in missing_items (and unavailable findings)."},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"slots":[{"zone":"Z1","slot":"09-11","capacityOrders":10,"booked":10,"available":0},{"zone":"Z1","slot":"11-13","capacityOrders":10,"booked":0,"available":10}],"sources":[{"source":"Caller-supplied coordinates or distance/duration matrices processed locally","url":"https://www.brainiac.software/api/v1/route-optimization","retrievedAt":"2026-11-14","status":"ok"}],"limitations":["Usable minutes = slot length × (1 − buffer) − stem; orders/vehicle = floor(usable/(service+drive)).","Outputs are route and delivery calculations for human review. They are not legal, customs, tax, medical or identity det…","…"]}}}},"400":{"description":"Invalid JSON or request schema. Not charged (no payment-response). If this 400 is returned before the Idempotency-Key is reserved, the key is not stored — fix the body and you may reuse the key. If an operation-path 400 was stored after a payment-signature was attached, the same key + same body replays it; the same key + a different body returns 409."},"402":{"description":"Payment required. The JSON body is the x402 PaymentRequired object. An unpaid 402 does not store the Idempotency-Key. A 402 after payment-signature releases the key and includes prior-payment-attempt (nonce, settled false|unknown). Not charged; no payment-response. Before re-signing after a post-signature 402, check USDC authorizationState(payer, nonce) on Base."},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Same key with a different body after a stored result returns conflict. Reusing the key cannot trigger a second charge. Not charged when settlement did not occur."},"413":{"description":"Request body exceeds the 24 MB limit. Not charged."},"500":{"description":"Operation failed before settlement, so no payment is taken (no payment-response). The error is stored: reuse the same Idempotency-Key and body to retrieve it without paying again. Use a new key for a fresh attempt with a new payment-signature."},"502":{"description":"Facilitator verify/settle transport failure (often timeout). After payment-signature this is returned as SETTLEMENT_UNKNOWN with prior-payment-attempt; the outcome is stored under the Idempotency-Key. With the shared store configured, other instances replay it instead of settling again; without it, each instance keeps its own memory. The authorization may already be settled on-chain — do not re-sign until USDC authorizationState(payer, nonce) on Base is false."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run. Not charged; no payment-response. A 503 after payment-signature releases the Idempotency-Key and includes prior-payment-attempt."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.02"},"protocols":[{"x402":{"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}],"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}},"/api/v1/route-optimization/geofence-check":{"post":{"operationId":"geofence_point_in_polygon_check","summary":"Geofence point-in-polygon check","description":"Test points against GeoJSON service zones with holes, reporting inside/in-hole status and nearest boundary distance.","tags":["route-optimization"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"zones":{"type":"object","properties":{"type":{"type":"string","const":"FeatureCollection"},"features":{"minItems":1,"maxItems":1000,"type":"array","items":{"type":"object","properties":{"type":{"type":"string","const":"Feature"},"properties":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"geometry":{"type":"object","properties":{"type":{"type":"string","enum":["Polygon","MultiPolygon"]},"coordinates":{"type":"array","items":{}}},"required":["type","coordinates"],"additionalProperties":false}},"required":["type","geometry"],"additionalProperties":false}}},"required":["type","features"],"additionalProperties":false},"points":{"minItems":1,"maxItems":10000,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"lon":{"type":"number","minimum":-180,"maximum":180},"lat":{"type":"number","minimum":-90,"maximum":90}},"required":["id","lon","lat"],"additionalProperties":false}}},"required":["zones","points"],"additionalProperties":false},"example":{"zones":{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"id":"zone1"},"geometry":{"type":"Polygon","coordinates":[[[0,0],[0,1],[1,1],[1,0],[0,0]],[[0.4,0.4],[0.4,0.6],[0.6,0.6],[0.6,0.4],[0.4,0.4]]]}}]},"points":[{"id":"p1","lon":0.2,"lat":0.2},{"id":"p2","lon":0.5,"lat":0.5},{"id":"p3","lon":1.5,"lat":0.5}]}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. For coverage operations, HTTP 200 is used for status complete, partial, and failed; all three settle and are charged at the full listed price. A settled 2xx includes a payment-response response header (facilitator settlement receipt; may include a transaction reference). Conditional fields depend on the result and data-source availability.","headers":{"payment-response":{"description":"Present on settled 2xx only. Facilitator settlement receipt for the x402 payment (not present on 4xx/5xx, which are not charged).","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"results":{"type":"array","items":{"type":["object","string"],"properties":{"point":{"type":"string"},"inside":{"type":"array","items":{"type":"string"}},"nearestBoundaryM":{"type":"number"},"inHoleOf":{"type":"array","items":{"type":"string"}},"nearestZone":{"type":"string"}},"additionalProperties":true}},"sources":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string"},"url":{"type":"string"},"retrievedAt":{"type":"string"},"status":{"type":"string"}},"additionalProperties":true},"description":"Provenance only (source, url, retrievedAt). Not keyed by check id and does not carry success or error. A check in missing_items does not remove its upstream from sources[]; unavailability is only in missing_items (and unavailable findings)."},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"results":[{"point":"p1","inside":["zone1"],"nearestBoundaryM":22238.88},{"point":"p2","inside":[],"inHoleOf":["zone1"],"nearestZone":"zone1","nearestBoundaryM":11119.08},"…"],"sources":[{"source":"Caller-supplied coordinates or distance/duration matrices processed locally","url":"https://www.brainiac.software/api/v1/route-optimization","retrievedAt":"2026-11-14","status":"ok"}],"limitations":["GeoJSON RFC 7946 point-in-polygon (even-odd) with holes; boundary distance uses great-circle cross-track formulas.","Outputs are route and delivery calculations for human review. They are not legal, customs, tax, medical or identity det…","…"]}}}},"400":{"description":"Invalid JSON or request schema. Not charged (no payment-response). If this 400 is returned before the Idempotency-Key is reserved, the key is not stored — fix the body and you may reuse the key. If an operation-path 400 was stored after a payment-signature was attached, the same key + same body replays it; the same key + a different body returns 409."},"402":{"description":"Payment required. The JSON body is the x402 PaymentRequired object. An unpaid 402 does not store the Idempotency-Key. A 402 after payment-signature releases the key and includes prior-payment-attempt (nonce, settled false|unknown). Not charged; no payment-response. Before re-signing after a post-signature 402, check USDC authorizationState(payer, nonce) on Base."},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Same key with a different body after a stored result returns conflict. Reusing the key cannot trigger a second charge. Not charged when settlement did not occur."},"413":{"description":"Request body exceeds the 24 MB limit. Not charged."},"500":{"description":"Operation failed before settlement, so no payment is taken (no payment-response). The error is stored: reuse the same Idempotency-Key and body to retrieve it without paying again. Use a new key for a fresh attempt with a new payment-signature."},"502":{"description":"Facilitator verify/settle transport failure (often timeout). After payment-signature this is returned as SETTLEMENT_UNKNOWN with prior-payment-attempt; the outcome is stored under the Idempotency-Key. With the shared store configured, other instances replay it instead of settling again; without it, each instance keeps its own memory. The authorization may already be settled on-chain — do not re-sign until USDC authorizationState(payer, nonce) on Base is false."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run. Not charged; no payment-response. A 503 after payment-signature releases the Idempotency-Key and includes prior-payment-attempt."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.02"},"protocols":[{"x402":{"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}],"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}},"/api/v1/route-optimization/polyline-codec":{"post":{"operationId":"encoded_polyline_encode_decode","summary":"Encoded polyline encode/decode","description":"Encode or decode Google Encoded Polyline strings and optionally simplify with Douglas-Peucker.","tags":["route-optimization"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"encode":{"minItems":1,"maxItems":100000,"type":"array","items":{"type":"array","prefixItems":[{"type":"number"},{"type":"number"}],"items":false,"minItems":2,"maxItems":2}},"decode":{"anyOf":[{"type":"string","maxLength":1000000},{"type":"null"}]},"precision":{"anyOf":[{"type":"number","const":5},{"type":"number","const":6}]},"simplify":{"anyOf":[{"type":"object","properties":{"toleranceM":{"type":"number","exclusiveMinimum":0},"tolerance":{"type":"number","exclusiveMinimum":0}},"additionalProperties":false},{"type":"null"}]}},"additionalProperties":false},"example":{"encode":[[38.5,-120.2],[40.7,-120.95],[43.252,-126.453]],"decode":null,"precision":5,"simplify":null}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. For coverage operations, HTTP 200 is used for status complete, partial, and failed; all three settle and are charged at the full listed price. A settled 2xx includes a payment-response response header (facilitator settlement receipt; may include a transaction reference). Conditional fields depend on the result and data-source availability.","headers":{"payment-response":{"description":"Present on settled 2xx only. Facilitator settlement receipt for the x402 payment (not present on 4xx/5xx, which are not charged).","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"encoded":{"type":"string"},"points":{"type":"number"},"sources":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string"},"url":{"type":"string"},"retrievedAt":{"type":"string"},"status":{"type":"string"}},"additionalProperties":true},"description":"Provenance only (source, url, retrievedAt). Not keyed by check id and does not carry success or error. A check in missing_items does not remove its upstream from sources[]; unavailability is only in missing_items (and unavailable findings)."},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"encoded":"_p~iF~ps|U_ulLnnqC_mqNvxq`@","points":3,"sources":[{"source":"Caller-supplied coordinates or distance/duration matrices processed locally","url":"https://www.brainiac.software/api/v1/route-optimization","retrievedAt":"2026-11-14","status":"ok"}],"limitations":["Encoded Polyline Algorithm Format (Google), documentation under CC BY 4.0; algorithm only.","Douglas-Peucker simplify uses planar tolerance in input units or local equirectangular metres.","…"]}}}},"400":{"description":"Invalid JSON or request schema. Not charged (no payment-response). If this 400 is returned before the Idempotency-Key is reserved, the key is not stored — fix the body and you may reuse the key. If an operation-path 400 was stored after a payment-signature was attached, the same key + same body replays it; the same key + a different body returns 409."},"402":{"description":"Payment required. The JSON body is the x402 PaymentRequired object. An unpaid 402 does not store the Idempotency-Key. A 402 after payment-signature releases the key and includes prior-payment-attempt (nonce, settled false|unknown). Not charged; no payment-response. Before re-signing after a post-signature 402, check USDC authorizationState(payer, nonce) on Base."},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Same key with a different body after a stored result returns conflict. Reusing the key cannot trigger a second charge. Not charged when settlement did not occur."},"413":{"description":"Request body exceeds the 24 MB limit. Not charged."},"500":{"description":"Operation failed before settlement, so no payment is taken (no payment-response). The error is stored: reuse the same Idempotency-Key and body to retrieve it without paying again. Use a new key for a fresh attempt with a new payment-signature."},"502":{"description":"Facilitator verify/settle transport failure (often timeout). After payment-signature this is returned as SETTLEMENT_UNKNOWN with prior-payment-attempt; the outcome is stored under the Idempotency-Key. With the shared store configured, other instances replay it instead of settling again; without it, each instance keeps its own memory. The authorization may already be settled on-chain — do not re-sign until USDC authorizationState(payer, nonce) on Base is false."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run. Not charged; no payment-response. A 503 after payment-signature releases the Idempotency-Key and includes prior-payment-attempt."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.01"},"protocols":[{"x402":{"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}],"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}},"/api/v1/route-optimization/route-plan-validate":{"post":{"operationId":"validate_a_multi_vehicle_route_plan","summary":"Validate a multi-vehicle route plan","description":"Check a manual plan for time-window, capacity, shift, precedence and duplicate/missing-stop violations.","tags":["route-optimization"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"depot":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"x":{"type":"number"},"y":{"type":"number"},"lat":{"type":"number","minimum":-90,"maximum":90},"lon":{"type":"number","minimum":-180,"maximum":180},"window":{"type":"array","prefixItems":[{"type":"number"},{"type":"number"}],"items":false,"minItems":2,"maxItems":2}},"required":["id"],"additionalProperties":false},"stops":{"minItems":1,"maxItems":2000,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"x":{"type":"number"},"y":{"type":"number"},"lat":{"type":"number","minimum":-90,"maximum":90},"lon":{"type":"number","minimum":-180,"maximum":180},"window":{"type":"array","prefixItems":[{"type":"number"},{"type":"number"}],"items":false,"minItems":2,"maxItems":2},"service":{"type":"number","minimum":0},"demand":{"anyOf":[{"type":"number","minimum":0},{"minItems":1,"maxItems":8,"type":"array","items":{"type":"number","minimum":0}}]}},"required":["id"],"additionalProperties":false}},"vehicles":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"shift":{"type":"array","prefixItems":[{"type":"number"},{"type":"number"}],"items":false,"minItems":2,"maxItems":2},"capacity":{"anyOf":[{"type":"number","minimum":0},{"minItems":1,"maxItems":8,"type":"array","items":{"type":"number","minimum":0}}]},"breaks":{"type":"array","items":{"type":"object","properties":{"window":{"type":"array","prefixItems":[{"type":"number"},{"type":"number"}],"items":false,"minItems":2,"maxItems":2},"duration":{"type":"number","minimum":0}},"required":["window","duration"],"additionalProperties":false}}},"required":["id"],"additionalProperties":false}},"plan":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"vehicle":{"type":"string","minLength":1,"maxLength":120},"sequence":{"minItems":1,"maxItems":2000,"type":"array","items":{"type":"string","minLength":1,"maxLength":120}}},"required":["vehicle","sequence"],"additionalProperties":false}},"requests":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"pickup":{"type":"string","minLength":1,"maxLength":120},"delivery":{"type":"string","minLength":1,"maxLength":120},"quantity":{"type":"number","minimum":0}},"required":["id","pickup","delivery","quantity"],"additionalProperties":false}},"matrix":{"type":"object","properties":{"distances":{"minItems":1,"maxItems":2000,"type":"array","items":{"type":"array","items":{"type":"number"}}},"durations":{"minItems":1,"maxItems":2000,"type":"array","items":{"type":"array","items":{"type":"number"}}}},"required":["distances"],"additionalProperties":false},"matrixFromPoints":{"type":"string","enum":["euclidean","haversine"]},"speed":{"type":"number","exclusiveMinimum":0},"requireAllStops":{"type":"boolean"}},"required":["stops","vehicles","plan"],"additionalProperties":false},"example":{"depot":{"id":"depot","x":0,"y":0,"window":[0,100]},"stops":[{"id":"a","x":2,"y":6,"window":[25,40],"service":2},{"id":"b","x":5,"y":2,"window":[0,10],"service":2},{"id":"c","x":6,"y":6,"window":[15,30],"service":2},{"id":"d","x":8,"y":3,"window":[5,20],"service":2},{"id":"e","x":1,"y":3,"window":[35,50],"service":2}],"vehicles":[{"id":"v1","shift":[0,100]}],"plan":[{"vehicle":"v1","sequence":["b","d","a","c","e"]}],"matrixFromPoints":"euclidean","speed":1,"requireAllStops":true}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. For coverage operations, HTTP 200 is used for status complete, partial, and failed; all three settle and are charged at the full listed price. A settled 2xx includes a payment-response response header (facilitator settlement receipt; may include a transaction reference). Conditional fields depend on the result and data-source availability.","headers":{"payment-response":{"description":"Present on settled 2xx only. Facilitator settlement receipt for the x402 payment (not present on 4xx/5xx, which are not charged).","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"valid":{"type":"boolean"},"violations":{"type":"array","items":{"type":"object","properties":{"vehicle":{"type":"string"},"stopIndex":{"type":"number"},"stop":{"type":"string"},"type":{"type":"string"},"detail":{"type":"string"}},"additionalProperties":true}},"missing":{"type":"array","items":{}},"duplicates":{"type":"array","items":{}},"sources":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string"},"url":{"type":"string"},"retrievedAt":{"type":"string"},"status":{"type":"string"}},"additionalProperties":true},"description":"Provenance only (source, url, retrievedAt). Not keyed by check id and does not carry success or error. A check in missing_items does not remove its upstream from sources[]; unavailability is only in missing_items (and unavailable findings)."},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"valid":false,"violations":[{"vehicle":"v1","stopIndex":3,"stop":"c","type":"time_window","detail":"arrival 31.0000 > latest 30"}],"missing":[],"duplicates":[],"sources":[{"source":"Caller-supplied coordinates or distance/duration matrices processed locally","url":"https://www.brainiac.software/api/v1/route-optimization","retrievedAt":"2026-11-14","status":"ok"}],"limitations":["Validates time windows, capacity, shift, precedence and duplicate/missing stops on a manual plan.","Outputs are route and delivery calculations for human review. They are not legal, customs, tax, medical or identity det…","…"]}}}},"400":{"description":"Invalid JSON or request schema. Not charged (no payment-response). If this 400 is returned before the Idempotency-Key is reserved, the key is not stored — fix the body and you may reuse the key. If an operation-path 400 was stored after a payment-signature was attached, the same key + same body replays it; the same key + a different body returns 409."},"402":{"description":"Payment required. The JSON body is the x402 PaymentRequired object. An unpaid 402 does not store the Idempotency-Key. A 402 after payment-signature releases the key and includes prior-payment-attempt (nonce, settled false|unknown). Not charged; no payment-response. Before re-signing after a post-signature 402, check USDC authorizationState(payer, nonce) on Base."},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Same key with a different body after a stored result returns conflict. Reusing the key cannot trigger a second charge. Not charged when settlement did not occur."},"413":{"description":"Request body exceeds the 24 MB limit. Not charged."},"500":{"description":"Operation failed before settlement, so no payment is taken (no payment-response). The error is stored: reuse the same Idempotency-Key and body to retrieve it without paying again. Use a new key for a fresh attempt with a new payment-signature."},"502":{"description":"Facilitator verify/settle transport failure (often timeout). After payment-signature this is returned as SETTLEMENT_UNKNOWN with prior-payment-attempt; the outcome is stored under the Idempotency-Key. With the shared store configured, other instances replay it instead of settling again; without it, each instance keeps its own memory. The authorization may already be settled on-chain — do not re-sign until USDC authorizationState(payer, nonce) on Base is false."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run. Not charged; no payment-response. A 503 after payment-signature releases the Idempotency-Key and includes prior-payment-attempt."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.02"},"protocols":[{"x402":{"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}],"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}}},"components":{"schemas":{"ApiError":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}}}}}}}}