API REFERENCE

Atomically create and schedule one reservation order

POST/api/v1/businesses/{id}/reservations/{offer}/confirm

Inherits selected location/duration/window and retained lock policy; revalidates current capacity under transaction. Creates one new order, expires sibling/conflicting options; failed duplicate/validation leaves valid reservations intact. Driver publication remains separate. Integration permission: reservations.confirm. Administrator membership grants management access only to this business.

Authentication

Authorized business administrator session, or a business API key with reservations.confirm.

Parameters

ParameterInTypeDescription
idRequiredpathstringAuthorized business context. Never inferred from client record IDs.Format: uuid
offerRequiredpathstringFormat: uuid

Request

FieldTypeDescription & constraints
idstringIdentifier unique within its authorized business. Some create operations generate it when omitted.
custom_fieldsobjectValues keyed by the business-defined custom field IDs. Existing orders retain their schema version.

Example JSON body

{
  "id": "job-1001",
  "custom_fields": {}
}
Request schema
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "custom_fields": {
      "type": "object",
      "additionalProperties": true
    }
  }
}

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/reservations/offer-01/confirm' \
  --header 'Authorization: Bearer REPLACE_WITH_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{"id":"job-1001","custom_fields":{}}'

Responses

Examples illustrate the documented shape; optional fields and current state can differ. JSON extraction/body-limit errors may be plain text.

200 · Successful response

application/json

FieldTypeDescription & constraints
orderobjectResource-specific value; see the related workflow and schema.
plansarray<object>Resource-specific value; see the related workflow and schema.
order fields
FieldTypeDescription & constraints
order.idstringOptional on creation; generated if absent. Unique within authorized business; duplicates409 even if payload matches.Max length: 120
order.typetask | breakRecord or field type; choose one of the listed values.
order.locationRequiredobjectService or record location, using latitude/longitude in decimal degrees.
order.duration_secondsRequiredintegerTime needed to do the work, excluding travel, in seconds.Min: 1
order.window_startRequiredstringRFC3339 UTC instant or explicit offset; business wall times are resolved separately.Format: date-time
order.window_endRequiredstringRFC3339 UTC instant or explicit offset; business wall times are resolved separately.Format: date-time
order.statuscreated | on_road | in_progress | completed | unable_to_complete | cancelledLive execution status. Administrator changes become pending_status until publication.
order.pending_statuscreated | on_road | in_progress | completed | unable_to_complete | cancelled | nullResource-specific value; see the related workflow and schema.
order.scheduled_atstring | nullPlanned service-start instant; absence indicates unplanned work.
order.vehicle_idstring | nullAssigned or selected vehicle ID in this business.
order.driver_idstring | nullAssigned driver ID; stop-specific assignments can change after a handover.
order.replacement_driver_idstring | nullAdministrator-selected replacement driver for a handover break.
order.custom_fieldsobjectValues keyed by the business-defined custom field IDs. Existing orders retain their schema version.
order.schema_snapshotobjectImmutable field definition/type/permission version for this order.Response only
order.actual_started_atstring | nullResource-specific value; see the related workflow and schema.
order.actual_completed_atstring | nullResource-specific value; see the related workflow and schema.
order.location fields
FieldTypeDescription & constraints
order.location.latitudeRequirednumberLatitude in decimal degrees, from -90 to 90.Min: -90 · Max: 90
order.location.longitudeRequirednumberLongitude in decimal degrees, from -180 to 180.Min: -180 · Max: 180
plans[] fields
FieldTypeDescription & constraints
plans.idRequiredstringIdentifier unique within its authorized business. Some create operations generate it when omitted.
plans.vehicle_idRequiredstringAssigned or selected vehicle ID in this business.
plans.driver_idstring | nullAssigned driver ID; stop-specific assignments can change after a handover.
plans.revisionRequiredintegerCurrent version used to detect stale edits or publication.
plans.stateRequiredplanning | published | supersededPlanning/published version state or event visibility state.
plans.start_atstringRFC3339 UTC instant or explicit offset; business wall times are resolved separately.Format: date-time
plans.end_atstringRFC3339 UTC instant or explicit offset; business wall times are resolved separately.Format: date-time
plans.stopsRequiredarray<object>Ordered planned route stops.
plans.return_legobjectResource-specific value; see the related workflow and schema.
plans.warningsarray<string>Constraint warnings requiring review where applicable.
plans.unplanned_order_idsarray<string>Resource-specific value; see the related workflow and schema.
plans.publishedobject | nullResource-specific value; see the related workflow and schema.
plans.received_atstring | nullResource-specific value; see the related workflow and schema.
Illustrative response
{
  "order": {
    "id": "example-id",
    "type": "task",
    "location": {
      "latitude": 52.2297,
      "longitude": 21.0122
    },
    "duration_seconds": 1800,
    "window_start": "2026-11-02T09:00:00Z",
    "window_end": "2026-11-02T12:00:00Z",
    "status": "created",
    "pending_status": "created",
    "scheduled_at": "2026-11-02T09:30:00Z",
    "vehicle_id": "van-01",
    "driver_id": "driver-01",
    "replacement_driver_id": "example",
    "custom_fields": {},
    "schema_snapshot": {},
    "actual_started_at": "2026-11-02T09:00:00Z",
    "actual_completed_at": "2026-11-02T09:00:00Z"
  },
  "plans": [
    {
      "id": "example-id",
      "vehicle_id": "van-01",
      "driver_id": "driver-01",
      "revision": 1,
      "state": "planning",
      "start_at": "2026-11-02T08:00:00Z",
      "end_at": "2026-11-02T16:00:00Z",
      "stops": [
        {}
      ],
      "return_leg": {},
      "warnings": [
        "example"
      ],
      "unplanned_order_ids": [
        "example"
      ],
      "published": {},
      "received_at": "2026-11-02T09:00:00Z"
    }
  ]
}
Response schema
{
  "type": "object",
  "properties": {
    "order": {
      "$ref": "#/components/schemas/Order"
    },
    "plans": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/Plan"
      }
    }
  }
}

401 · Missing/invalid/revoked token

application/json

FieldTypeDescription & constraints
errorRequiredobjectResource-specific value; see the related workflow and schema.
error fields
FieldTypeDescription & constraints
error.codeRequiredvalidation | unauthorized | not_found | conflict | unavailable | rate_limitedPrivate activation or recovery code supplied to the driver.
error.messageRequiredstringResource-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

FieldTypeDescription & constraints
errorRequiredobjectResource-specific value; see the related workflow and schema.
error fields
FieldTypeDescription & constraints
error.codeRequiredvalidation | unauthorized | not_found | conflict | unavailable | rate_limitedPrivate activation or recovery code supplied to the driver.
error.messageRequiredstringResource-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

FieldTypeDescription & constraints
errorRequiredobjectResource-specific value; see the related workflow and schema.
error fields
FieldTypeDescription & constraints
error.codeRequiredvalidation | unauthorized | not_found | conflict | unavailable | rate_limitedPrivate activation or recovery code supplied to the driver.
error.messageRequiredstringResource-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

FieldTypeDescription & constraints
errorRequiredobjectResource-specific value; see the related workflow and schema.
error fields
FieldTypeDescription & constraints
error.codeRequiredvalidation | unauthorized | not_found | conflict | unavailable | rate_limitedPrivate activation or recovery code supplied to the driver.
error.messageRequiredstringResource-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

FieldTypeDescription & constraints
errorRequiredobjectResource-specific value; see the related workflow and schema.
error fields
FieldTypeDescription & constraints
error.codeRequiredvalidation | unauthorized | not_found | conflict | unavailable | rate_limitedPrivate activation or recovery code supplied to the driver.
error.messageRequiredstringResource-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

FieldTypeDescription & constraints
errorRequiredobjectResource-specific value; see the related workflow and schema.
error fields
FieldTypeDescription & constraints
error.codeRequiredvalidation | unauthorized | not_found | conflict | unavailable | rate_limitedPrivate activation or recovery code supplied to the driver.
error.messageRequiredstringResource-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"
}
← All endpointsIntegration workflows →