API REFERENCE
Start real background planning job
/api/v1/businesses/{id}/planning/previewIndependent locks default false; include_planned defaults false. Feasibility still accounts for existing work. Select eligible assigned vans; window/hours/duty constraints remain strict. Job updates planning versions only; publication is explicit. No usable result preserves current planning plan. Integration permission: planning.run. Administrator membership grants management access only to this business.
Authentication
Authorized business administrator session, or a business API key with planning.run.
Parameters
| Parameter | In | Type | Description |
|---|---|---|---|
idRequired | path | string | Authorized business context. Never inferred from client record IDs.Format: uuid |
Request
| Field | Type | Description & constraints |
|---|---|---|
vehicle_idsRequired | array<string> | IDs of eligible vehicles selected for the planning run. |
date_startRequired | string | First planning date in the business time zone.Format: date |
date_endRequired | string | Last planning date in the business time zone.Format: date |
dates | array<string> | Explicit local calendar dates to consider, when supported. |
schedule_lock | boolean | Preserve existing planned start times and relative stop order. Defaults to false. |
assignment_lock | boolean | Preserve existing vehicle/driver assignments. Defaults to false. |
include_planned | boolean | Include already-planned orders in the planning run. Defaults to false. |
objectives | array<completed_tasks | travel> | Planning objectives; completing more work and minimizing travel can be combined. |
Example JSON body
{
"vehicle_ids": [
"van-01"
],
"date_start": "2026-11-02",
"date_end": "2026-11-02",
"dates": [
"2026-11-02"
],
"schedule_lock": false,
"assignment_lock": false,
"include_planned": false,
"objectives": [
"completed_tasks",
"travel"
]
}Request schema
{
"$ref": "#/components/schemas/PlanningRequest"
}Example request
Replace synthetic identifiers and credentials. Example dates, coordinates, revisions, and IDs are not production defaults. Read the workflow guide before making a write.
curl --request POST 'https://route-api.okok.space/api/v1/businesses/11111111-1111-4111-8111-111111111111/planning/preview' \
--header 'Authorization: Bearer REPLACE_WITH_TOKEN' \
--header 'Content-Type: application/json' \
--data '{"vehicle_ids":["van-01"],"date_start":"2026-11-02","date_end":"2026-11-02","dates":["2026-11-02"],"schedule_lock":false,"assignment_lock":false,"include_planned":false,"objectives":["completed_tasks","travel"]}'Responses
Examples illustrate the documented shape; optional fields and current state can differ. JSON extraction/body-limit errors may be plain text.
202 · Successful response
application/json
| Field | Type | Description & constraints |
|---|---|---|
job_id | string | Resource-specific value; see the related workflow and schema.Format: uuid |
status | string | Current execution or operation state. Planned/unplanned is separate from execution. |
Illustrative response
{
"job_id": "11111111-1111-4111-8111-111111111111",
"status": "example"
}Response schema
{
"type": "object",
"properties": {
"job_id": {
"type": "string",
"format": "uuid"
},
"status": {
"type": "string"
}
}
}401 · Missing/invalid/revoked token
application/json
| Field | Type | Description & constraints |
|---|---|---|
errorRequired | object | Resource-specific value; see the related workflow and schema. |
error fields
| Field | Type | Description & constraints |
|---|---|---|
error.codeRequired | validation | unauthorized | not_found | conflict | unavailable | rate_limited | Private activation or recovery code supplied to the driver. |
error.messageRequired | string | Resource-specific value; see the related workflow and schema. |
Illustrative response
{
"error": {
"code": "unauthorized",
"message": "Missing/invalid/revoked token"
}
}Response schema
{
"$ref": "#/components/schemas/Error"
}403 · Business membership or required API-key scope denied
application/json
| Field | Type | Description & constraints |
|---|---|---|
errorRequired | object | Resource-specific value; see the related workflow and schema. |
error fields
| Field | Type | Description & constraints |
|---|---|---|
error.codeRequired | validation | unauthorized | not_found | conflict | unavailable | rate_limited | Private activation or recovery code supplied to the driver. |
error.messageRequired | string | Resource-specific value; see the related workflow and schema. |
Illustrative response
{
"error": {
"code": "unauthorized",
"message": "Business membership or required API-key scope denied"
}
}Response schema
{
"$ref": "#/components/schemas/Error"
}404 · Record not found in authorized business
application/json
| Field | Type | Description & constraints |
|---|---|---|
errorRequired | object | Resource-specific value; see the related workflow and schema. |
error fields
| Field | Type | Description & constraints |
|---|---|---|
error.codeRequired | validation | unauthorized | not_found | conflict | unavailable | rate_limited | Private activation or recovery code supplied to the driver. |
error.messageRequired | string | Resource-specific value; see the related workflow and schema. |
Illustrative response
{
"error": {
"code": "not_found",
"message": "Record not found in authorized business"
}
}Response schema
{
"$ref": "#/components/schemas/Error"
}409 · Duplicate identifier, stale revision, expired reservation, protected publication or unavailable capacity
application/json
| Field | Type | Description & constraints |
|---|---|---|
errorRequired | object | Resource-specific value; see the related workflow and schema. |
error fields
| Field | Type | Description & constraints |
|---|---|---|
error.codeRequired | validation | unauthorized | not_found | conflict | unavailable | rate_limited | Private activation or recovery code supplied to the driver. |
error.messageRequired | string | Resource-specific value; see the related workflow and schema. |
Illustrative response
{
"error": {
"code": "conflict",
"message": "Duplicate identifier, stale revision, expired reservation, protected publication or unavailable capacity"
}
}Response schema
{
"$ref": "#/components/schemas/Error"
}422 · Domain validation rejected the operation
application/json
| Field | Type | Description & constraints |
|---|---|---|
errorRequired | object | Resource-specific value; see the related workflow and schema. |
error fields
| Field | Type | Description & constraints |
|---|---|---|
error.codeRequired | validation | unauthorized | not_found | conflict | unavailable | rate_limited | Private activation or recovery code supplied to the driver. |
error.messageRequired | string | Resource-specific value; see the related workflow and schema. |
Illustrative response
{
"error": {
"code": "validation",
"message": "Domain validation rejected the operation"
}
}Response schema
{
"$ref": "#/components/schemas/Error"
}503 · Required persistence, map/routing or other infrastructure unavailable
application/json
| Field | Type | Description & constraints |
|---|---|---|
errorRequired | object | Resource-specific value; see the related workflow and schema. |
error fields
| Field | Type | Description & constraints |
|---|---|---|
error.codeRequired | validation | unauthorized | not_found | conflict | unavailable | rate_limited | Private activation or recovery code supplied to the driver. |
error.messageRequired | string | Resource-specific value; see the related workflow and schema. |
Illustrative response
{
"error": {
"code": "unavailable",
"message": "Required persistence, map/routing or other infrastructure unavailable"
}
}Response schema
{
"$ref": "#/components/schemas/Error"
}