https://www.brainiac.software/api/v1/route-optimization/distance-matrix$0.02 USDCGreat-circle distance and duration matrix
Build a haversine distance and estimated duration matrix from caller coordinates with optional circuity and speed.
Body
| Field | Required | Notes |
|---|---|---|
locations | Yes | array; Array |
circuity | No | number |
speedKph | No | number |
speedMps | No | number |
Request exampleJSON
{
"locations": [
{
"id": "london",
"lat": 51.5074,
"lon": -0.1278
},
{
"id": "paris",
"lat": 48.8566,
"lon": 2.3522
}
],
"circuity": 1,
"speedKph": 80
}Response exampleJSON
{
"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…",
"…"
]
}cURL
curl -i -X POST "https://www.brainiac.software/api/v1/route-optimization/distance-matrix" \
-H 'content-type: application/json' \
-H 'Idempotency-Key: <fresh-64-character-random-hex-key>' \
--data-binary @- <<'JSON'
{
"locations": [
{
"id": "london",
"lat": 51.5074,
"lon": -0.1278
},
{
"id": "paris",
"lat": 48.8566,
"lon": 2.3522
}
],
"circuity": 1,
"speedKph": 80
}
JSONhttps://www.brainiac.software/api/v1/route-optimization/tsp-optimize$0.05 USDCTravelling salesman route order
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.
Body
| Field | Required | Notes |
|---|---|---|
locations | Yes | array; Array |
matrix | No | object; Object |
matrixFromPoints | No | string; One of: euclidean, haversine |
circuity | No | number |
speedMps | No | number |
speed | No | number |
start | Yes | string |
end | No | — |
objective | No | string; One of: distance, duration |
timeLimitMs | No | integer |
Request exampleJSON
{
"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
}Response exampleJSON
{
"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.",
"…"
]
}cURL
curl -i -X POST "https://www.brainiac.software/api/v1/route-optimization/tsp-optimize" \
-H 'content-type: application/json' \
-H 'Idempotency-Key: <fresh-64-character-random-hex-key>' \
--data-binary @- <<'JSON'
{
"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
}
JSONhttps://www.brainiac.software/api/v1/route-optimization/vrp-capacitated$0.05 USDCCapacitated vehicle routing
Assign stops to vehicles under capacity (and optional duration) limits, returning routes with loads and distances.
Body
| Field | Required | Notes |
|---|---|---|
depot | Yes | object; Object |
stops | Yes | array; Array |
vehicles | Yes | array; Array |
matrix | No | object; Object |
matrixFromPoints | No | string; One of: euclidean, haversine |
circuity | No | number |
speedMps | No | number |
speed | No | number |
maxRouteDuration | No | — |
minimise | No | string; One of: distance, duration |
timeLimitMs | No | integer |
Request exampleJSON
{
"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"
}Response exampleJSON
{
"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.",
"…"
]
}cURL
curl -i -X POST "https://www.brainiac.software/api/v1/route-optimization/vrp-capacitated" \
-H 'content-type: application/json' \
-H 'Idempotency-Key: <fresh-64-character-random-hex-key>' \
--data-binary @- <<'JSON'
{
"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"
}
JSONhttps://www.brainiac.software/api/v1/route-optimization/vrp-time-windows$0.05 USDCVehicle routing with time windows
Route stops under customer time windows, service times, driver shifts and breaks with forward time propagation.
Body
| Field | Required | Notes |
|---|---|---|
depot | Yes | object; Object |
stops | Yes | array; Array |
vehicles | Yes | array; Array |
matrix | No | object; Object |
matrixFromPoints | No | string; One of: euclidean, haversine |
circuity | No | number |
speed | No | number |
speedMps | No | number |
minimise | No | string; One of: distance, completion_time, vehicles |
timeLimitMs | No | integer |
Request exampleJSON
{
"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"
}Response exampleJSON
{
"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…",
"…"
]
}cURL
curl -i -X POST "https://www.brainiac.software/api/v1/route-optimization/vrp-time-windows" \
-H 'content-type: application/json' \
-H 'Idempotency-Key: <fresh-64-character-random-hex-key>' \
--data-binary @- <<'JSON'
{
"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"
}
JSONhttps://www.brainiac.software/api/v1/route-optimization/pickup-delivery$0.05 USDCPickup and delivery routing
Route paired pickup-and-delivery requests with precedence, same-vehicle and capacity constraints.
Body
| Field | Required | Notes |
|---|---|---|
depot | Yes | object; Object |
requests | Yes | array; Array |
vehicles | Yes | array; Array |
matrix | No | object; Object |
matrixFromPoints | No | string; One of: euclidean, haversine |
circuity | No | number |
speed | No | number |
timeLimitMs | No | integer |
Request exampleJSON
{
"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"
}Response exampleJSON
{
"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…",
"…"
]
}cURL
curl -i -X POST "https://www.brainiac.software/api/v1/route-optimization/pickup-delivery" \
-H 'content-type: application/json' \
-H 'Idempotency-Key: <fresh-64-character-random-hex-key>' \
--data-binary @- <<'JSON'
{
"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"
}
JSONhttps://www.brainiac.software/api/v1/route-optimization/multi-day-plan$0.05 USDCMulti-day visit planning
Assign recurring visits across a horizon with frequency and spacing rules, then route each day.
Body
| Field | Required | Notes |
|---|---|---|
horizonDays | Yes | array; Array |
stops | Yes | array; Array |
depot | Yes | object; Object |
vehiclesPerDay | No | integer |
capacityPerDay | No | — |
matrix | No | object; Object |
matrixFromPoints | No | string; One of: euclidean, haversine |
timeLimitMs | No | integer |
Request exampleJSON
{
"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"
}Response exampleJSON
{
"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…",
"…"
]
}cURL
curl -i -X POST "https://www.brainiac.software/api/v1/route-optimization/multi-day-plan" \
-H 'content-type: application/json' \
-H 'Idempotency-Key: <fresh-64-character-random-hex-key>' \
--data-binary @- <<'JSON'
{
"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"
}
JSONhttps://www.brainiac.software/api/v1/route-optimization/territory-cluster$0.03 USDCBalanced territory clustering
Split stops into k balanced, compact territories with capacitated k-means and imbalance limits.
Body
| Field | Required | Notes |
|---|---|---|
stops | Yes | array; Array |
k | Yes | integer |
balanceBy | No | string; One of: count, weight |
maxImbalance | No | number |
matrixFromPoints | No | string; One of: euclidean, haversine |
seed | No | integer |
Request exampleJSON
{
"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"
}Response exampleJSON
{
"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…",
"…"
]
}cURL
curl -i -X POST "https://www.brainiac.software/api/v1/route-optimization/territory-cluster" \
-H 'content-type: application/json' \
-H 'Idempotency-Key: <fresh-64-character-random-hex-key>' \
--data-binary @- <<'JSON'
{
"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"
}
JSONhttps://www.brainiac.software/api/v1/route-optimization/depot-location-optimize$0.04 USDCDepot / hub location (p-median)
Choose p hub locations from candidates to minimise demand-weighted distance, optionally capacitated.
Body
| Field | Required | Notes |
|---|---|---|
demand | Yes | array; Array |
candidates | Yes | array; Array |
p | Yes | integer |
matrix | No | object; Object |
matrixFromPoints | No | string; One of: euclidean, haversine |
capacities | No | — |
Request exampleJSON
{
"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
}Response exampleJSON
{
"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…",
"…"
]
}cURL
curl -i -X POST "https://www.brainiac.software/api/v1/route-optimization/depot-location-optimize" \
-H 'content-type: application/json' \
-H 'Idempotency-Key: <fresh-64-character-random-hex-key>' \
--data-binary @- <<'JSON'
{
"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
}
JSONhttps://www.brainiac.software/api/v1/route-optimization/route-eta-schedule$0.02 USDCETA schedule for a fixed sequence
Compute arrivals, waits, slack and overtime for a fixed stop sequence with optional return and shift end.
Body
| Field | Required | Notes |
|---|---|---|
start | Yes | object; Object |
sequence | Yes | array; Array |
returnTo | No | object; Object |
matrix | No | object; Object |
matrixFromPoints | No | string; One of: euclidean, haversine |
speed | No | number |
speedMps | No | number |
shiftEnd | No | number |
Request exampleJSON
{
"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
}Response exampleJSON
{
"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…",
"…"
]
}cURL
curl -i -X POST "https://www.brainiac.software/api/v1/route-optimization/route-eta-schedule" \
-H 'content-type: application/json' \
-H 'Idempotency-Key: <fresh-64-character-random-hex-key>' \
--data-binary @- <<'JSON'
{
"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
}
JSONhttps://www.brainiac.software/api/v1/route-optimization/vehicle-load-sequence$0.03 USDCVehicle loading order and 3D fit
Order parcels last-delivered-first and run a deterministic layer first-fit packing check in a van or truck box.
Body
| Field | Required | Notes |
|---|---|---|
box | Yes | object; Object |
parcels | Yes | array; Array |
units | No | string |
Request exampleJSON
{
"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"
}Response exampleJSON
{
"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…",
"…"
]
}cURL
curl -i -X POST "https://www.brainiac.software/api/v1/route-optimization/vehicle-load-sequence" \
-H 'content-type: application/json' \
-H 'Idempotency-Key: <fresh-64-character-random-hex-key>' \
--data-binary @- <<'JSON'
{
"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"
}
JSONhttps://www.brainiac.software/api/v1/route-optimization/driver-shift-assign$0.03 USDCAssign routes to drivers
Assign pre-built routes to drivers by shift, skills and vehicle type with min-cost Hungarian matching.
Body
| Field | Required | Notes |
|---|---|---|
routes | Yes | array; Array |
drivers | Yes | array; Array |
skillMode | No | string; One of: strict, soft |
skillPenalty | No | number |
allowMultiple | No | boolean |
Request exampleJSON
{
"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"
}Response exampleJSON
{
"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…",
"…"
]
}cURL
curl -i -X POST "https://www.brainiac.software/api/v1/route-optimization/driver-shift-assign" \
-H 'content-type: application/json' \
-H 'Idempotency-Key: <fresh-64-character-random-hex-key>' \
--data-binary @- <<'JSON'
{
"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"
}
JSONhttps://www.brainiac.software/api/v1/route-optimization/delivery-slot-capacity$0.02 USDCDelivery slot capacity
Estimate bookable orders per zone and time slot from vehicle time, service, drive and stem assumptions.
Body
| Field | Required | Notes |
|---|---|---|
zones | Yes | array; Array |
slots | Yes | array; Array |
booked | No | array; Array |
bufferPct | No | number |
stemEverySlot | No | boolean |
Request exampleJSON
{
"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
}Response exampleJSON
{
"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…",
"…"
]
}cURL
curl -i -X POST "https://www.brainiac.software/api/v1/route-optimization/delivery-slot-capacity" \
-H 'content-type: application/json' \
-H 'Idempotency-Key: <fresh-64-character-random-hex-key>' \
--data-binary @- <<'JSON'
{
"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
}
JSONhttps://www.brainiac.software/api/v1/route-optimization/geofence-check$0.02 USDCGeofence point-in-polygon check
Test points against GeoJSON service zones with holes, reporting inside/in-hole status and nearest boundary distance.
Body
| Field | Required | Notes |
|---|---|---|
zones | Yes | object; Object |
points | Yes | array; Array |
Request exampleJSON
{
"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
}
]
}Response exampleJSON
{
"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…",
"…"
]
}cURL
curl -i -X POST "https://www.brainiac.software/api/v1/route-optimization/geofence-check" \
-H 'content-type: application/json' \
-H 'Idempotency-Key: <fresh-64-character-random-hex-key>' \
--data-binary @- <<'JSON'
{
"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
}
]
}
JSONhttps://www.brainiac.software/api/v1/route-optimization/polyline-codec$0.01 USDCEncoded polyline encode/decode
Encode or decode Google Encoded Polyline strings and optionally simplify with Douglas-Peucker.
Body
| Field | Required | Notes |
|---|---|---|
encode | No | array; Array |
decode | No | — |
precision | No | — |
simplify | No | — |
Request exampleJSON
{
"encode": [
[
38.5,
-120.2
],
[
40.7,
-120.95
],
[
43.252,
-126.453
]
],
"decode": null,
"precision": 5,
"simplify": null
}Response exampleJSON
{
"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.",
"…"
]
}cURL
curl -i -X POST "https://www.brainiac.software/api/v1/route-optimization/polyline-codec" \
-H 'content-type: application/json' \
-H 'Idempotency-Key: <fresh-64-character-random-hex-key>' \
--data-binary @- <<'JSON'
{
"encode": [
[
38.5,
-120.2
],
[
40.7,
-120.95
],
[
43.252,
-126.453
]
],
"decode": null,
"precision": 5,
"simplify": null
}
JSONhttps://www.brainiac.software/api/v1/route-optimization/route-plan-validate$0.02 USDCValidate a multi-vehicle route plan
Check a manual plan for time-window, capacity, shift, precedence and duplicate/missing-stop violations.
Body
| Field | Required | Notes |
|---|---|---|
depot | No | object; Object |
stops | Yes | array; Array |
vehicles | Yes | array; Array |
plan | Yes | array; Array |
requests | No | array; Array |
matrix | No | object; Object |
matrixFromPoints | No | string; One of: euclidean, haversine |
speed | No | number |
requireAllStops | No | boolean |
Request exampleJSON
{
"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
}Response exampleJSON
{
"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…",
"…"
]
}cURL
curl -i -X POST "https://www.brainiac.software/api/v1/route-optimization/route-plan-validate" \
-H 'content-type: application/json' \
-H 'Idempotency-Key: <fresh-64-character-random-hex-key>' \
--data-binary @- <<'JSON'
{
"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
}
JSON