# Engine API reference

> Every endpoint of the Engine API.

Create and operate jobs: the nodes a bot visits, the actions at each node, packages, hooks and events.

- Base URL: `https://api.remi.robot.com/api/v3`
- Auth: An API key with the `engine` scope, sent as `Authorization: Bearer <key>`. Ask your Robot.com representative for one.
- OpenAPI document: https://docs.remi.robot.com/openapi/engine.json

## Jobs

Create, read, edit and delete jobs: a sequence of stops (nodes) for a bot, each with actions.

### Count jobs by state

`GET /engine/jobs/overview` (scope `engine`)

Totals for your namespace. `completedLast24h` and `failedLast24h` count jobs that reached that state in the last 24 hours.

Query parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `locations` | `string` | no | Comma-separated location ids. Only jobs at these locations. |

Response 200: The counts.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `JobOverview` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |

Example response:

```json
{
  "data": {
    "total": 1280,
    "active": 12,
    "draft": 1,
    "scheduled": 2,
    "pending": 3,
    "in_progress": 5,
    "paused": 1,
    "completed": 1240,
    "failed": 9,
    "canceled": 19,
    "completedLast24h": 87,
    "failedLast24h": 1
  }
}
```

### List jobs

`GET /engine/jobs` (scope `engine`)

Newest first by default. Send `next_cursor.id` as `cursor_id` and `next_cursor.createdAt` as `cursor_created_at` to get the next page. `next_cursor` is null on the last page.

Query parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `locations` | `string` | no | Comma-separated location ids. Only jobs at these locations. |
| `active` | `'true' \| 'false'` | no | `true`: draft, scheduled, pending, in progress and paused jobs. `false`: completed, failed and canceled jobs. |
| `limit` | `integer` | no | Page size, 1 to 1000. Default 100. 1 to 1000. Default `100`. |
| `cursor_id` | `string` | no | `next_cursor.id` of the previous page. Send it with `cursor_created_at`. |
| `cursor_created_at` | `string` | no | `next_cursor.createdAt` of the previous page. Send it with `cursor_id`. |
| `order` | `'asc' \| 'desc'` | no | By creation time. Default `desc`. Default `"desc"`. |

Response 200: A page of jobs.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `Job[]` | yes |  |
| `pagination` | `object` | yes |  |
| `pagination.next_cursor` | `object \| null` | yes |  |
| `pagination.next_cursor.id` | `string` | yes |  |
| `pagination.next_cursor.createdAt` | `string` | yes |  |
| `pagination.limit` | `number` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 |  | Invalid query, for example `limit` above 1000. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |

Example response:

```json
{
  "data": [
    {
      "id": "ES-5867",
      "namespace": "partner_example",
      "externalId": "order-4821",
      "locationId": "7Nk2QhVpXrLmT4wZaBcDe",
      "version": 4,
      "name": "Order #4821",
      "description": null,
      "pictureURL": null,
      "assignation": "auto",
      "start": "auto",
      "state": "in_progress",
      "currentNodeIndex": 0,
      "priority": 0,
      "expendable": false,
      "createdManually": false,
      "scheduledAt": null,
      "targetCompletionAt": null,
      "startedAt": "2026-06-17T15:43:10.000Z",
      "finalizedAt": null,
      "botId": "4T001",
      "requiresBot": true,
      "requiredBotTags": null,
      "createdAt": "2026-06-17T15:42:00.000Z",
      "updatedAt": "2026-06-17T15:43:10.000Z",
      "tags": null,
      "metadata": null,
      "nodes": [
        {
          "jobId": "ES-5867",
          "name": "pickup",
          "description": null,
          "pictureURL": null,
          "index": 0,
          "pointId": "V1StGXR8Z5jdHi6BmyT2q",
          "lat": 4.6512,
          "lng": -74.0689,
          "azimuth": null,
          "positionIndex": 0,
          "hasPositionDefined": true,
          "distance": 1240,
          "travelDuration": 480000,
          "actionsDuration": 120000,
          "totalDuration": 600000,
          "estimatedArrivalAt": "2026-06-17T15:51:00.000Z",
          "startedAt": "2026-06-17T15:43:10.000Z",
          "departedAt": "2026-06-17T15:43:10.000Z",
          "arrivedAt": null,
          "finalizedAt": null,
          "state": "in_progress",
          "transitState": "in_transit",
          "allowFailure": false,
          "expendable": false,
          "tags": null,
          "released": true,
          "metadata": null,
          "actions": [
            {
              "jobId": "ES-5867",
              "nodeName": "pickup",
              "name": "load",
              "index": 0,
              "type": "load",
              "blockingType": "hard",
              "state": "pending",
              "allowFailure": false,
              "packageName": "pkg-1",
              "bundleName": null,
              "metadata": null,
              "startedAt": null,
              "finalizedAt": null,
              "duration": 120000,
              "createdAt": "2026-06-17T15:42:00.000Z",
              "updatedAt": null
            }
          ]
        },
        {
          "jobId": "ES-5867",
          "name": "dropoff",
          "description": null,
          "pictureURL": null,
          "index": 1,
          "pointId": null,
          "lat": 4.6602,
          "lng": -74.0521,
          "azimuth": null,
          "positionIndex": 1,
          "hasPositionDefined": true,
          "distance": 0,
          "travelDuration": 1500000,
          "actionsDuration": 60000,
          "totalDuration": 1560000,
          "estimatedArrivalAt": "2026-06-17T16:12:00.000Z",
          "startedAt": null,
          "departedAt": null,
          "arrivedAt": null,
          "finalizedAt": null,
          "state": "pending",
          "transitState": null,
          "allowFailure": false,
          "expendable": false,
          "tags": null,
          "released": true,
          "metadata": null,
          "actions": [
            {
              "jobId": "ES-5867",
              "nodeName": "dropoff",
              "name": "unload",
              "index": 0,
              "type": "unload",
              "blockingType": "hard",
              "state": "pending",
              "allowFailure": false,
              "packageName": "pkg-1",
              "bundleName": null,
              "metadata": null,
              "startedAt": null,
              "finalizedAt": null,
              "duration": 60000,
              "createdAt": "2026-06-17T15:42:00.000Z",
              "updatedAt": null
            }
          ]
        }
      ],
      "packages": [
        {
          "jobId": "ES-5867",
          "name": "pkg-1",
          "bundleName": null,
          "description": null,
          "pictureURL": null,
          "items": [
            {
              "name": "Cheeseburger",
              "quantity": 1
            }
          ],
          "metadata": null,
          "station": "Burger Shop",
          "createdAt": "2026-06-17T15:42:00.000Z"
        }
      ]
    }
  ],
  "pagination": {
    "next_cursor": {
      "id": "ES-5867",
      "createdAt": "2026-06-17T15:42:00.000Z"
    },
    "limit": 1
  }
}
```

### Create a job

`POST /engine/jobs` (scope `engine`)

Creates the job with its nodes, actions, packages and hooks in one call.

- `namespace` must be your key namespace.
- The response may come before the travel estimates of the nodes are calculated. Get the job again to read them.
- To schedule it, send `state: scheduled` with `scheduledAt`.

Body:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `namespace` | `string` | yes | The namespace the job belongs to. Must be your API key's namespace. Up to 255 characters. |
| `externalId` | `string \| null` | no | Your own reference for the job. Unique among the active jobs of the namespace. Up to 255 characters. |
| `locationId` | `string` | yes | The location the job is associated with. Up to 255 characters. |
| `name` | `string` | yes | The name of the job Up to 255 characters. |
| `description` | `string \| null` | no | A description in markdown format. Up to 1024 characters. |
| `pictureURL` | `string (uri) \| null` | no | URL of a picture of the job. |
| `priority` | `number` | no | The priority of the job from 0 (lowest) to 100 (highest). 0 to 100. |
| `expendable` | `boolean` | no | If true, the job can be ended early to free its bot without counting as failed. |
| `botId` | `string \| null` | no | The bot for the job, for example `4T001`. It must be at the job's location and connected. |
| `requireAvailableBot` | `boolean` | no | When true and no specific bot is pinned, reject creation (NO_AVAILABLE_BOT) unless at least one bot is available for the location/namespace. Ignored for draft/scheduled jobs. |
| `requiresBot` | `boolean` | no | When false, the job runs without a bot: it can start and progress with no bot assigned, bots cannot be assigned to it, and it must use manual assignation. Defaults to true. |
| `requiredBotTags` | `string[] \| null` | no | Only bots carrying EVERY one of these bot tags are candidates. Empty or null means any bot. |
| `assignation` | `'auto' \| 'manual'` | no | `auto` (default): a bot is assigned for you. `manual`: you assign it. |
| `start` | `'auto' \| 'manual'` | no | `auto` (default): the job starts once a bot is assigned and free. `manual`: it waits for the start route. |
| `state` | `'draft' \| 'scheduled' \| 'pending' \| 'in_progress'` | no | Initial state. Defaults to `pending`. `scheduled` needs `scheduledAt`. |
| `tags` | `string[] \| null` | no | Labels for searching and filtering. |
| `metadata` | `Record<string, unknown> \| null` | no | A record of key-value pairs containing additional metadata about the entity. |
| `nodes` | `NewNode[] \| null` | no | The stops of the job, in visiting order. |
| `hooks` | `NewHook[] \| null` | no |  |
| `packages` | `NewPackage[] \| null` | no |  |
| `scheduledAt` | `string (date-time) \| null` | no | When the job should reach its first node. Required with `state: scheduled`. |
| `targetCompletionAt` | `string (date-time) \| null` | no | When the job is expected to finish. |

Response 201: The created job.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `Job` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 |  | Invalid body. |
| 400 | `HOOK_ACTION_NOT_ALLOWED` | `action` is not `call_webhook`, or `target` is not an `http(s)` URL. |
| 400 | `POINT_NOT_FOUND` | A node `pointId` is not a point of the job location. |
| 400 | `BOTLESS_JOB_CANNOT_HAVE_BOT` | `requiresBot` is false together with `botId` or `requireAvailableBot`. |
| 400 | `BOTLESS_JOB_MUST_BE_MANUAL_ASSIGNATION` | `requiresBot` is false and `assignation` is not `manual`. |
| 400 | `STATIONED_PACKAGES_REQUIRE_PER_PACKAGE_LOAD` | A load action without `packageName` covers packages of more than one station. |
| 400 | `INVALID_BOT` | `botId` does not exist or is at another location. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 403 |  | `namespace` is not your key namespace. |
| 409 | `NO_AVAILABLE_BOT` | With `requireAvailableBot` and no `botId`: no bot is available. |
| 409 | `BOT_UNAVAILABLE` | `botId` is retired, off duty, not connected, or belongs to another partner. |
| 409 | `BOT_BUSY` | `state` is `in_progress` and `botId` is on another job. |

Example request:

```json
{
  "namespace": "partner_example",
  "externalId": "order-4821",
  "locationId": "7Nk2QhVpXrLmT4wZaBcDe",
  "name": "Order #4821",
  "nodes": [
    {
      "name": "pickup",
      "pointId": "V1StGXR8Z5jdHi6BmyT2q",
      "actions": [
        {
          "name": "load",
          "type": "load",
          "packageName": "pkg-1"
        }
      ]
    },
    {
      "name": "dropoff",
      "lat": 4.6602,
      "lng": -74.0521,
      "actions": [
        {
          "name": "unload",
          "type": "unload",
          "packageName": "pkg-1"
        }
      ]
    }
  ],
  "packages": [
    {
      "name": "pkg-1",
      "station": "Burger Shop",
      "items": [
        {
          "name": "Cheeseburger",
          "quantity": 1
        }
      ]
    }
  ]
}
```

Example response:

```json
{
  "data": {
    "id": "ES-5867",
    "namespace": "partner_example",
    "externalId": "order-4821",
    "locationId": "7Nk2QhVpXrLmT4wZaBcDe",
    "version": 1,
    "name": "Order #4821",
    "description": null,
    "pictureURL": null,
    "assignation": "auto",
    "start": "auto",
    "state": "pending",
    "currentNodeIndex": null,
    "priority": 0,
    "expendable": false,
    "createdManually": false,
    "scheduledAt": null,
    "targetCompletionAt": null,
    "startedAt": null,
    "finalizedAt": null,
    "botId": null,
    "requiresBot": true,
    "requiredBotTags": null,
    "createdAt": "2026-06-17T15:42:00.000Z",
    "updatedAt": null,
    "tags": null,
    "metadata": null,
    "nodes": [
      {
        "jobId": "ES-5867",
        "name": "pickup",
        "description": null,
        "pictureURL": null,
        "index": 0,
        "pointId": "V1StGXR8Z5jdHi6BmyT2q",
        "lat": 4.6512,
        "lng": -74.0689,
        "azimuth": null,
        "positionIndex": 0,
        "hasPositionDefined": true,
        "distance": 1240,
        "travelDuration": 480000,
        "actionsDuration": 120000,
        "totalDuration": 600000,
        "estimatedArrivalAt": "2026-06-17T15:51:00.000Z",
        "startedAt": null,
        "departedAt": null,
        "arrivedAt": null,
        "finalizedAt": null,
        "state": "pending",
        "transitState": null,
        "allowFailure": false,
        "expendable": false,
        "tags": null,
        "released": true,
        "metadata": null,
        "actions": [
          {
            "jobId": "ES-5867",
            "nodeName": "pickup",
            "name": "load",
            "index": 0,
            "type": "load",
            "blockingType": "hard",
            "state": "pending",
            "allowFailure": false,
            "packageName": "pkg-1",
            "bundleName": null,
            "metadata": null,
            "startedAt": null,
            "finalizedAt": null,
            "duration": 120000,
            "createdAt": "2026-06-17T15:42:00.000Z",
            "updatedAt": null
          }
        ]
      },
      {
        "jobId": "ES-5867",
        "name": "dropoff",
        "description": null,
        "pictureURL": null,
        "index": 1,
        "pointId": null,
        "lat": 4.6602,
        "lng": -74.0521,
        "azimuth": null,
        "positionIndex": 1,
        "hasPositionDefined": true,
        "distance": 0,
        "travelDuration": 1500000,
        "actionsDuration": 60000,
        "totalDuration": 1560000,
        "estimatedArrivalAt": "2026-06-17T16:12:00.000Z",
        "startedAt": null,
        "departedAt": null,
        "arrivedAt": null,
        "finalizedAt": null,
        "state": "pending",
        "transitState": null,
        "allowFailure": false,
        "expendable": false,
        "tags": null,
        "released": true,
        "metadata": null,
        "actions": [
          {
            "jobId": "ES-5867",
            "nodeName": "dropoff",
            "name": "unload",
            "index": 0,
            "type": "unload",
            "blockingType": "hard",
            "state": "pending",
            "allowFailure": false,
            "packageName": "pkg-1",
            "bundleName": null,
            "metadata": null,
            "startedAt": null,
            "finalizedAt": null,
            "duration": 60000,
            "createdAt": "2026-06-17T15:42:00.000Z",
            "updatedAt": null
          }
        ]
      }
    ],
    "packages": [
      {
        "jobId": "ES-5867",
        "name": "pkg-1",
        "bundleName": null,
        "description": null,
        "pictureURL": null,
        "items": [
          {
            "name": "Cheeseburger",
            "quantity": 1
          }
        ],
        "metadata": null,
        "station": "Burger Shop",
        "createdAt": "2026-06-17T15:42:00.000Z"
      }
    ]
  }
}
```

### Get the active job of a bot

`GET /engine/jobs/by-bot/{botId}` (scope `engine`)

The in-progress or paused job of the bot. `data` is null when the bot has none.

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `botId` | `string` | yes | Bot id, for example `4T001`. |

Query parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `include_hooks` | `'true' \| 'false'` | no | `true` to include the job hooks. |
| `include_events` | `'true' \| 'false'` | no | `true` to include the job events. |
| `include_alerts` | `'true' \| 'false'` | no | `true` to include the job alerts. |

Response 200: The job, or null.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `Job \| null` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |

Example response:

```json
{
  "data": {
    "id": "ES-5867",
    "namespace": "partner_example",
    "externalId": "order-4821",
    "locationId": "7Nk2QhVpXrLmT4wZaBcDe",
    "version": 4,
    "name": "Order #4821",
    "description": null,
    "pictureURL": null,
    "assignation": "auto",
    "start": "auto",
    "state": "in_progress",
    "currentNodeIndex": 0,
    "priority": 0,
    "expendable": false,
    "createdManually": false,
    "scheduledAt": null,
    "targetCompletionAt": null,
    "startedAt": "2026-06-17T15:43:10.000Z",
    "finalizedAt": null,
    "botId": "4T001",
    "requiresBot": true,
    "requiredBotTags": null,
    "createdAt": "2026-06-17T15:42:00.000Z",
    "updatedAt": "2026-06-17T15:43:10.000Z",
    "tags": null,
    "metadata": null,
    "nodes": [
      {
        "jobId": "ES-5867",
        "name": "pickup",
        "description": null,
        "pictureURL": null,
        "index": 0,
        "pointId": "V1StGXR8Z5jdHi6BmyT2q",
        "lat": 4.6512,
        "lng": -74.0689,
        "azimuth": null,
        "positionIndex": 0,
        "hasPositionDefined": true,
        "distance": 1240,
        "travelDuration": 480000,
        "actionsDuration": 120000,
        "totalDuration": 600000,
        "estimatedArrivalAt": "2026-06-17T15:51:00.000Z",
        "startedAt": "2026-06-17T15:43:10.000Z",
        "departedAt": "2026-06-17T15:43:10.000Z",
        "arrivedAt": null,
        "finalizedAt": null,
        "state": "in_progress",
        "transitState": "in_transit",
        "allowFailure": false,
        "expendable": false,
        "tags": null,
        "released": true,
        "metadata": null,
        "actions": [
          {
            "jobId": "ES-5867",
            "nodeName": "pickup",
            "name": "load",
            "index": 0,
            "type": "load",
            "blockingType": "hard",
            "state": "pending",
            "allowFailure": false,
            "packageName": "pkg-1",
            "bundleName": null,
            "metadata": null,
            "startedAt": null,
            "finalizedAt": null,
            "duration": 120000,
            "createdAt": "2026-06-17T15:42:00.000Z",
            "updatedAt": null
          }
        ]
      },
      {
        "jobId": "ES-5867",
        "name": "dropoff",
        "description": null,
        "pictureURL": null,
        "index": 1,
        "pointId": null,
        "lat": 4.6602,
        "lng": -74.0521,
        "azimuth": null,
        "positionIndex": 1,
        "hasPositionDefined": true,
        "distance": 0,
        "travelDuration": 1500000,
        "actionsDuration": 60000,
        "totalDuration": 1560000,
        "estimatedArrivalAt": "2026-06-17T16:12:00.000Z",
        "startedAt": null,
        "departedAt": null,
        "arrivedAt": null,
        "finalizedAt": null,
        "state": "pending",
        "transitState": null,
        "allowFailure": false,
        "expendable": false,
        "tags": null,
        "released": true,
        "metadata": null,
        "actions": [
          {
            "jobId": "ES-5867",
            "nodeName": "dropoff",
            "name": "unload",
            "index": 0,
            "type": "unload",
            "blockingType": "hard",
            "state": "pending",
            "allowFailure": false,
            "packageName": "pkg-1",
            "bundleName": null,
            "metadata": null,
            "startedAt": null,
            "finalizedAt": null,
            "duration": 60000,
            "createdAt": "2026-06-17T15:42:00.000Z",
            "updatedAt": null
          }
        ]
      }
    ],
    "packages": [
      {
        "jobId": "ES-5867",
        "name": "pkg-1",
        "bundleName": null,
        "description": null,
        "pictureURL": null,
        "items": [
          {
            "name": "Cheeseburger",
            "quantity": 1
          }
        ],
        "metadata": null,
        "station": "Burger Shop",
        "createdAt": "2026-06-17T15:42:00.000Z"
      }
    ]
  }
}
```

### Get a job

`GET /engine/jobs/{id}` (scope `engine`)

Includes nodes, actions and packages.

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | yes | Job id. |

Query parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `include_hooks` | `'true' \| 'false'` | no | `true` to include the job hooks. |
| `include_events` | `'true' \| 'false'` | no | `true` to include the job events. |
| `include_alerts` | `'true' \| 'false'` | no | `true` to include the job alerts. |

Response 200: The job.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `Job` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |

Example response:

```json
{
  "data": {
    "id": "ES-5867",
    "namespace": "partner_example",
    "externalId": "order-4821",
    "locationId": "7Nk2QhVpXrLmT4wZaBcDe",
    "version": 4,
    "name": "Order #4821",
    "description": null,
    "pictureURL": null,
    "assignation": "auto",
    "start": "auto",
    "state": "in_progress",
    "currentNodeIndex": 0,
    "priority": 0,
    "expendable": false,
    "createdManually": false,
    "scheduledAt": null,
    "targetCompletionAt": null,
    "startedAt": "2026-06-17T15:43:10.000Z",
    "finalizedAt": null,
    "botId": "4T001",
    "requiresBot": true,
    "requiredBotTags": null,
    "createdAt": "2026-06-17T15:42:00.000Z",
    "updatedAt": "2026-06-17T15:43:10.000Z",
    "tags": null,
    "metadata": null,
    "nodes": [
      {
        "jobId": "ES-5867",
        "name": "pickup",
        "description": null,
        "pictureURL": null,
        "index": 0,
        "pointId": "V1StGXR8Z5jdHi6BmyT2q",
        "lat": 4.6512,
        "lng": -74.0689,
        "azimuth": null,
        "positionIndex": 0,
        "hasPositionDefined": true,
        "distance": 1240,
        "travelDuration": 480000,
        "actionsDuration": 120000,
        "totalDuration": 600000,
        "estimatedArrivalAt": "2026-06-17T15:51:00.000Z",
        "startedAt": "2026-06-17T15:43:10.000Z",
        "departedAt": "2026-06-17T15:43:10.000Z",
        "arrivedAt": null,
        "finalizedAt": null,
        "state": "in_progress",
        "transitState": "in_transit",
        "allowFailure": false,
        "expendable": false,
        "tags": null,
        "released": true,
        "metadata": null,
        "actions": [
          {
            "jobId": "ES-5867",
            "nodeName": "pickup",
            "name": "load",
            "index": 0,
            "type": "load",
            "blockingType": "hard",
            "state": "pending",
            "allowFailure": false,
            "packageName": "pkg-1",
            "bundleName": null,
            "metadata": null,
            "startedAt": null,
            "finalizedAt": null,
            "duration": 120000,
            "createdAt": "2026-06-17T15:42:00.000Z",
            "updatedAt": null
          }
        ]
      },
      {
        "jobId": "ES-5867",
        "name": "dropoff",
        "description": null,
        "pictureURL": null,
        "index": 1,
        "pointId": null,
        "lat": 4.6602,
        "lng": -74.0521,
        "azimuth": null,
        "positionIndex": 1,
        "hasPositionDefined": true,
        "distance": 0,
        "travelDuration": 1500000,
        "actionsDuration": 60000,
        "totalDuration": 1560000,
        "estimatedArrivalAt": "2026-06-17T16:12:00.000Z",
        "startedAt": null,
        "departedAt": null,
        "arrivedAt": null,
        "finalizedAt": null,
        "state": "pending",
        "transitState": null,
        "allowFailure": false,
        "expendable": false,
        "tags": null,
        "released": true,
        "metadata": null,
        "actions": [
          {
            "jobId": "ES-5867",
            "nodeName": "dropoff",
            "name": "unload",
            "index": 0,
            "type": "unload",
            "blockingType": "hard",
            "state": "pending",
            "allowFailure": false,
            "packageName": "pkg-1",
            "bundleName": null,
            "metadata": null,
            "startedAt": null,
            "finalizedAt": null,
            "duration": 60000,
            "createdAt": "2026-06-17T15:42:00.000Z",
            "updatedAt": null
          }
        ]
      }
    ],
    "packages": [
      {
        "jobId": "ES-5867",
        "name": "pkg-1",
        "bundleName": null,
        "description": null,
        "pictureURL": null,
        "items": [
          {
            "name": "Cheeseburger",
            "quantity": 1
          }
        ],
        "metadata": null,
        "station": "Burger Shop",
        "createdAt": "2026-06-17T15:42:00.000Z"
      }
    ]
  }
}
```

### Update a job

`PATCH /engine/jobs/{id}` (scope `engine`)

Send only what changes. `state` moves the job like the lifecycle routes, and `botId` assigns the bot (null unassigns it).

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | yes | Job id. |

Body:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `externalId` | `string \| null` | no | Your own reference for the job. Unique among the active jobs of the namespace. Up to 255 characters. |
| `name` | `string` | no | The name of the job Up to 255 characters. |
| `description` | `string \| null` | no | A description in markdown format. Up to 1024 characters. |
| `pictureURL` | `string (uri) \| null` | no | URL of a picture of the job. |
| `priority` | `number` | no | The priority of the job from 0 (lowest) to 100 (highest). 0 to 100. |
| `expendable` | `boolean` | no | If true, the job can be ended early to free its bot without counting as failed. |
| `botId` | `string \| null` | no | The bot for the job, for example `4T001`. It must be at the job's location and connected. |
| `requiredBotTags` | `string[] \| null` | no | Only bots carrying EVERY one of these bot tags are candidates. Empty or null means any bot. |
| `state` | `enum` | no | Move the job to this state. One of `draft`, `scheduled`, `pending`, `in_progress`, `paused`, `canceled`, `completed`, `failed`. |
| `tags` | `string[] \| null` | no | Labels for searching and filtering. |
| `metadata` | `Record<string, unknown> \| null` | no | A record of key-value pairs containing additional metadata about the entity. |
| `version` | `number` | no | The version of the job. Must match the next version of the job to update it. |
| `scheduledAt` | `string (date-time) \| null` | no | When the job should reach its first node. Required with `state: scheduled`. |
| `targetCompletionAt` | `string (date-time) \| null` | no | When the job is expected to finish. |

Response 200: The updated job.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `Job` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 |  | Invalid body. |
| 400 |  | The new `state` is not allowed from the current one. The code is the one of the matching lifecycle route, for example `CANCEL_JOB_ALREADY_FINALIZED`. |
| 400 | `CANNOT_START_JOB_NO_BOT` | `state` is `in_progress` and the job has no bot. |
| 400 | `ASSIGN_BOT_JOB_DOES_NOT_REQUIRE_BOT` | `botId` is set on a job with `requiresBot` false. |
| 400 | `ASSIGN_BOT_JOB_FINALIZED` | `botId` is set on a finished job. |
| 400 | `UNASSIGN_BOT_JOB_IN_PROGRESS` | `botId` is null on an in-progress job. |
| 400 | `JOB_SCHEDULED_AT_REQUIRED` | `state` is `scheduled`. Use the schedule route instead. |
| 400 | `INVALID_BOT` | The bot does not exist or is at another location. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |
| 409 | `JOB_VERSION_MISMATCH` | `version` is not the current `version` plus one. |
| 409 | `BOT_UNAVAILABLE` | The bot is retired, off duty, not connected, or belongs to another partner. |
| 409 | `BOT_BUSY` | The job is in progress and the bot is on another job. |

### Delete a draft job

`DELETE /engine/jobs/{id}` (scope `engine`)

Only drafts can be deleted. Cancel any other job.

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | yes | Job id. |

Response 200: The job was deleted.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `object` | yes |  |
| `data.deleted` | `true` | yes |  |
| `data.id` | `string` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 |  | The job is not a draft. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |

Example response:

```json
{
  "data": {
    "deleted": true,
    "id": "ES-5868"
  }
}
```

## Job lifecycle

Move a job through its states and decide which bot works on it.

### Start a job

`POST /engine/jobs/{id}/start` (scope `engine`)

Moves a pending or scheduled job to `in_progress`. It needs a bot unless `requiresBot` is false.

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | yes | Job id. |

Body (optional):

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `nextVersion` | `number` | no | Expected job version after this change: the current `version` plus one. If the job changed meanwhile the call fails with `JOB_VERSION_MISMATCH`. |

Response 200: The updated job.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `Job` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 | `CANNOT_START_JOB_NO_BOT` | The job has no bot and needs one. |
| 400 | `START_JOB_INVALID_STATE` | The job is not pending or scheduled. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |
| 409 | `JOB_VERSION_MISMATCH` | `nextVersion` is not the current `version` plus one. |

### Pause a job

`POST /engine/jobs/{id}/pause` (scope `engine`)

Stops the bot and pauses the running actions.

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | yes | Job id. |

Body (optional):

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `nextVersion` | `number` | no | Expected job version after this change: the current `version` plus one. If the job changed meanwhile the call fails with `JOB_VERSION_MISMATCH`. |

Response 200: The updated job.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `Job` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 | `PAUSE_JOB_INVALID_STATE` | The job is not in progress. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |
| 409 | `JOB_VERSION_MISMATCH` | `nextVersion` is not the current `version` plus one. |

### Resume a paused job

`POST /engine/jobs/{id}/resume` (scope `engine`)

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | yes | Job id. |

Body (optional):

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `nextVersion` | `number` | no | Expected job version after this change: the current `version` plus one. If the job changed meanwhile the call fails with `JOB_VERSION_MISMATCH`. |

Response 200: The updated job.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `Job` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 | `RESUME_JOB_INVALID_STATE` | The job is not paused. |
| 400 | `RESUME_JOB_NO_BOT` | The job has no bot and needs one. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |
| 409 | `JOB_VERSION_MISMATCH` | `nextVersion` is not the current `version` plus one. |

### Cancel a job

`POST /engine/jobs/{id}/cancel` (scope `engine`)

Stops the bot, cancels the unfinished actions and frees the bot. A canceled job cannot be resumed.

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | yes | Job id. |

Body (optional):

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `reason` | `string` | no | Why. Stored in the job `metadata.finalizationReason` unless one is already set. |
| `nextVersion` | `number` | no | Expected job version after this change: the current `version` plus one. If the job changed meanwhile the call fails with `JOB_VERSION_MISMATCH`. |

Response 200: The updated job.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `Job` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 |  | Invalid body. |
| 400 | `CANCEL_JOB_ALREADY_FINALIZED` | The job is already completed, failed or canceled. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |
| 409 | `JOB_VERSION_MISMATCH` | `nextVersion` is not the current `version` plus one. |

Example request:

```json
{
  "reason": "Customer canceled the order"
}
```

Example response:

```json
{
  "data": {
    "id": "ES-5867",
    "namespace": "partner_example",
    "externalId": "order-4821",
    "locationId": "7Nk2QhVpXrLmT4wZaBcDe",
    "version": 5,
    "name": "Order #4821",
    "description": null,
    "pictureURL": null,
    "assignation": "auto",
    "start": "auto",
    "state": "canceled",
    "currentNodeIndex": 0,
    "priority": 0,
    "expendable": false,
    "createdManually": false,
    "scheduledAt": null,
    "targetCompletionAt": null,
    "startedAt": "2026-06-17T15:43:10.000Z",
    "finalizedAt": "2026-06-17T15:45:00.000Z",
    "botId": "4T001",
    "requiresBot": true,
    "requiredBotTags": null,
    "createdAt": "2026-06-17T15:42:00.000Z",
    "updatedAt": "2026-06-17T15:45:00.000Z",
    "tags": null,
    "metadata": {
      "finalizationReason": "Customer canceled the order"
    },
    "nodes": [
      {
        "jobId": "ES-5867",
        "name": "pickup",
        "description": null,
        "pictureURL": null,
        "index": 0,
        "pointId": "V1StGXR8Z5jdHi6BmyT2q",
        "lat": 4.6512,
        "lng": -74.0689,
        "azimuth": null,
        "positionIndex": 0,
        "hasPositionDefined": true,
        "distance": 1240,
        "travelDuration": 480000,
        "actionsDuration": 120000,
        "totalDuration": 600000,
        "estimatedArrivalAt": "2026-06-17T15:51:00.000Z",
        "startedAt": "2026-06-17T15:43:10.000Z",
        "departedAt": "2026-06-17T15:43:10.000Z",
        "arrivedAt": null,
        "finalizedAt": null,
        "state": "in_progress",
        "transitState": "interrupted",
        "allowFailure": false,
        "expendable": false,
        "tags": null,
        "released": true,
        "metadata": null,
        "actions": [
          {
            "jobId": "ES-5867",
            "nodeName": "pickup",
            "name": "load",
            "index": 0,
            "type": "load",
            "blockingType": "hard",
            "state": "canceled",
            "allowFailure": false,
            "packageName": "pkg-1",
            "bundleName": null,
            "metadata": null,
            "startedAt": null,
            "finalizedAt": "2026-06-17T15:45:00.000Z",
            "duration": 120000,
            "createdAt": "2026-06-17T15:42:00.000Z",
            "updatedAt": null
          }
        ]
      },
      {
        "jobId": "ES-5867",
        "name": "dropoff",
        "description": null,
        "pictureURL": null,
        "index": 1,
        "pointId": null,
        "lat": 4.6602,
        "lng": -74.0521,
        "azimuth": null,
        "positionIndex": 1,
        "hasPositionDefined": true,
        "distance": 0,
        "travelDuration": 1500000,
        "actionsDuration": 60000,
        "totalDuration": 1560000,
        "estimatedArrivalAt": "2026-06-17T16:12:00.000Z",
        "startedAt": null,
        "departedAt": null,
        "arrivedAt": null,
        "finalizedAt": null,
        "state": "pending",
        "transitState": null,
        "allowFailure": false,
        "expendable": false,
        "tags": null,
        "released": true,
        "metadata": null,
        "actions": [
          {
            "jobId": "ES-5867",
            "nodeName": "dropoff",
            "name": "unload",
            "index": 0,
            "type": "unload",
            "blockingType": "hard",
            "state": "canceled",
            "allowFailure": false,
            "packageName": "pkg-1",
            "bundleName": null,
            "metadata": null,
            "startedAt": null,
            "finalizedAt": "2026-06-17T15:45:00.000Z",
            "duration": 60000,
            "createdAt": "2026-06-17T15:42:00.000Z",
            "updatedAt": null
          }
        ]
      }
    ],
    "packages": [
      {
        "jobId": "ES-5867",
        "name": "pkg-1",
        "bundleName": null,
        "description": null,
        "pictureURL": null,
        "items": [
          {
            "name": "Cheeseburger",
            "quantity": 1
          }
        ],
        "metadata": null,
        "station": "Burger Shop",
        "createdAt": "2026-06-17T15:42:00.000Z"
      }
    ]
  }
}
```

### Complete a job early

`POST /engine/jobs/{id}/complete` (scope `engine`)

Only for an in-progress job that is expendable, or whose current node is. Cancels the unfinished actions and frees the bot.

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | yes | Job id. |

Body (optional):

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `nextVersion` | `number` | no | Expected job version after this change: the current `version` plus one. If the job changed meanwhile the call fails with `JOB_VERSION_MISMATCH`. |

Response 200: The updated job.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `Job` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 | `COMPLETE_JOB_INVALID_STATE` | The job is not in progress. |
| 400 | `COMPLETE_JOB_NOT_EXPENDABLE` | Neither the job nor its current node is expendable. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |
| 409 | `JOB_VERSION_MISMATCH` | `nextVersion` is not the current `version` plus one. |

### Fail a job

`POST /engine/jobs/{id}/fail` (scope `engine`)

Stops the bot, cancels the unfinished actions and frees the bot.

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | yes | Job id. |

Body (optional):

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `reason` | `string` | no | Why. Stored in the job `metadata.finalizationReason` unless one is already set. |
| `nextVersion` | `number` | no | Expected job version after this change: the current `version` plus one. If the job changed meanwhile the call fails with `JOB_VERSION_MISMATCH`. |

Response 200: The updated job.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `Job` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 |  | Invalid body. |
| 400 | `FAIL_JOB_ALREADY_FINALIZED` | The job is already completed, failed or canceled. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |
| 409 | `JOB_VERSION_MISMATCH` | `nextVersion` is not the current `version` plus one. |

### Activate a draft job

`POST /engine/jobs/{id}/activate` (scope `engine`)

Moves a draft to `pending`. The job needs at least one node, and unique node, action and package names.

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | yes | Job id. |

Body (optional):

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `nextVersion` | `number` | no | Expected job version after this change: the current `version` plus one. If the job changed meanwhile the call fails with `JOB_VERSION_MISMATCH`. |

Response 200: The updated job.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `Job` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 | `ACTIVATE_JOB_INVALID_STATE` | The job is not a draft. |
| 400 | `VALIDATE_JOB_NO_NODES` | The job has no nodes. |
| 400 | `VALIDATE_JOB_DUPLICATE_NODE` | Two nodes share a name. |
| 400 | `VALIDATE_JOB_DUPLICATE_ACTION` | Two actions of a node share a name. |
| 400 | `VALIDATE_JOB_DUPLICATE_PACKAGE` | Two packages share a name. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |
| 409 | `JOB_VERSION_MISMATCH` | `nextVersion` is not the current `version` plus one. |

### Schedule a job

`POST /engine/jobs/{id}/schedule` (scope `engine`)

Moves a draft, or an already scheduled job, to `scheduled` for the given time.

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | yes | Job id. |

Body:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `scheduledAt` | `string (date-time)` | yes | When the job should reach its first node, as an ISO 8601 timestamp. |
| `nextVersion` | `number` | no | Expected job version after this change: the current `version` plus one. If the job changed meanwhile the call fails with `JOB_VERSION_MISMATCH`. |

Response 200: The updated job.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `Job` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 |  | Invalid body. |
| 400 | `SCHEDULE_JOB_INVALID_STATE` | The job is not a draft or scheduled. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |
| 409 | `JOB_VERSION_MISMATCH` | `nextVersion` is not the current `version` plus one. |

Example request:

```json
{
  "scheduledAt": "2026-06-17T18:00:00.000Z"
}
```

### Assign a bot

`POST /engine/jobs/{id}/assign-bot` (scope `engine`)

Replaces the current bot, if any. On a pending job with `start` set to `auto`, the job starts when the bot is free. On an in-progress job the bot takes over where the job is.

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | yes | Job id. |

Body:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `botId` | `string` | yes | The bot to assign, for example `4T001`. |
| `nextVersion` | `number` | no | Expected job version after this change: the current `version` plus one. If the job changed meanwhile the call fails with `JOB_VERSION_MISMATCH`. |

Response 200: The updated job.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `Job` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 |  | Invalid body. |
| 400 | `ASSIGN_BOT_JOB_DOES_NOT_REQUIRE_BOT` | The job has `requiresBot` false. |
| 400 | `ASSIGN_BOT_JOB_FINALIZED` | The job is completed, failed or canceled. |
| 400 | `INVALID_BOT` | The bot does not exist or is at another location. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |
| 409 | `JOB_VERSION_MISMATCH` | `nextVersion` is not the current `version` plus one. |
| 409 | `BOT_UNAVAILABLE` | The bot is retired, off duty, not connected, or belongs to another partner. |
| 409 | `BOT_BUSY` | The job is in progress and the bot is on another job. |

Example request:

```json
{
  "botId": "4T001"
}
```

### Unassign the bot

`POST /engine/jobs/{id}/unassign-bot` (scope `engine`)

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | yes | Job id. |

Body (optional):

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `nextVersion` | `number` | no | Expected job version after this change: the current `version` plus one. If the job changed meanwhile the call fails with `JOB_VERSION_MISMATCH`. |

Response 200: The updated job.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `Job` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 | `UNASSIGN_BOT_JOB_IN_PROGRESS` | The job is in progress. Pause it or assign another bot. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |
| 409 | `JOB_VERSION_MISMATCH` | `nextVersion` is not the current `version` plus one. |

### Swap the bots of two jobs

`POST /engine/jobs/swap-bots` (scope `engine`)

Both jobs need a bot, must be at the same location, and must not be finished. The swap is atomic.

Body:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `jobId1` | `string` | yes |  |
| `jobId2` | `string` | yes |  |
| `nextVersion1` | `number` | no | Expected version of `jobId1` after the swap: its current `version` plus one. |
| `nextVersion2` | `number` | no | Expected version of `jobId2` after the swap: its current `version` plus one. |

Response 200: Both jobs after the swap.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `object` | yes |  |
| `data.job1` | `Job` | yes |  |
| `data.job2` | `Job` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 |  | Invalid body. |
| 400 | `CANNOT_SWAP_SAME_JOB` | `jobId1` and `jobId2` are the same. |
| 400 | `NO_BOTS_TO_SWAP` | A job has no bot. |
| 400 | `UPDATE_JOB_LOCATION_NOT_DRAFT` | The jobs are at different locations. |
| 400 | `INVALID_BOT` | A bot is not valid for the other job. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |
| 409 | `JOB_VERSION_MISMATCH` | `nextVersion` is not the current `version` plus one. |
| 409 | `CANNOT_SWAP_FINALIZED_JOB` | A job is completed, failed or canceled. |
| 409 | `SAME_BOT_ASSIGNED` | Both jobs already have the same bot. |
| 409 | `BOT_UNAVAILABLE` | A bot is busy with a third job and the other job is in progress. |

Example request:

```json
{
  "jobId1": "ES-5867",
  "jobId2": "ES-5870"
}
```

### Move a bot to another job

`POST /engine/jobs/transfer-bot` (scope `engine`)

The source job loses its bot and the target job gets it. Both jobs must be at the same location and not be finished.

Body:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `sourceJobId` | `string` | yes | The job that gives up its bot. |
| `targetJobId` | `string` | yes | The job that receives the bot. |
| `nextVersionSource` | `number` | no | Expected version of the source job after the transfer: its current `version` plus one. |
| `nextVersionTarget` | `number` | no | Expected version of the target job after the transfer: its current `version` plus one. |

Response 200: Both jobs after the transfer.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `object` | yes |  |
| `data.sourceJob` | `Job` | yes |  |
| `data.targetJob` | `Job` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 |  | Invalid body. |
| 400 | `CANNOT_SWAP_SAME_JOB` | `sourceJobId` and `targetJobId` are the same. |
| 400 | `NO_BOT_ASSIGNED` | The source job has no bot. |
| 400 | `UPDATE_JOB_LOCATION_NOT_DRAFT` | The jobs are at different locations. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |
| 409 | `JOB_VERSION_MISMATCH` | `nextVersion` is not the current `version` plus one. |
| 409 | `CANNOT_SWAP_FINALIZED_JOB` | A job is completed, failed or canceled. |

Example request:

```json
{
  "sourceJobId": "ES-5867",
  "targetJobId": "ES-5870"
}
```

### Jump to a node

`POST /engine/jobs/{id}/jump-to` (scope `engine`)

Sends an in-progress job straight to a later node, skipping the ones in between.

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | yes | Job id. |

Body:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `nodeName` | `string` | yes | The node to go to. It must come after the current one and not be finished. |
| `nextVersion` | `number` | no | Expected job version after this change: the current `version` plus one. If the job changed meanwhile the call fails with `JOB_VERSION_MISMATCH`. |

Response 200: The updated job.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `Job` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 |  | Invalid body. |
| 400 | `JUMP_TO_NODE_INVALID_STATE` | The job is not in progress. |
| 400 | `JUMP_TO_NODE_NOT_FOUND` | The job has no node with this name. |
| 400 | `JUMP_TO_NODE_NOT_AFTER_CURRENT` | The node is not after the current one. |
| 400 | `JUMP_TO_NODE_ALREADY_FINALIZED` | The node is already completed or failed. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |
| 409 | `JOB_VERSION_MISMATCH` | `nextVersion` is not the current `version` plus one. |

Example request:

```json
{
  "nodeName": "dropoff"
}
```

## Nodes

The stops of a job.

### Add a node

`POST /engine/jobs/{jobId}/nodes` (scope `engine`)

Adds a stop to the job, with its actions. On an active job it cannot go before or at the current node.

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `jobId` | `string` | yes | Job id. |

Body:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `node` | `NewNode` | yes |  |
| `atIndex` | `number` | no | Position to insert the node at. Default: the end. |
| `jumpToImmediately` | `boolean` | no | On an in-progress job, send the bot to the new node right away, skipping the nodes in between. |

Response 201: The updated job.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `Job` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 |  | Invalid body. |
| 400 | `ADD_NODE_NAME_DUPLICATE` | The job already has a node with this name. |
| 400 | `ADD_NODE_INDEX_OUT_OF_BOUNDS` | `atIndex` is outside the job nodes. |
| 400 | `ADD_NODE_BEFORE_CURRENT` | The job is active and `atIndex` is at or before the current node. |
| 400 | `POINT_NOT_FOUND` | `pointId` is not a point of the job location. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |

Example request:

```json
{
  "node": {
    "name": "return",
    "lat": 4.6498,
    "lng": -74.0712
  }
}
```

### Update a node

`PATCH /engine/jobs/{jobId}/nodes/{nodeName}` (scope `engine`)

Send `pointId`, or `lat` with `lng`, to move the node. A node can be renamed only while pending, and moved only before the bot arrives.

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `jobId` | `string` | yes | Job id. |
| `nodeName` | `string` | yes | Node name. |

Body:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | `string` | no | The name of the entity. Must only contain alphanumeric characters, underscores, and hyphens. Up to 255 characters. |
| `pointId` | `string` | no | Move the node to this point of the job location. |
| `lat` | `number \| null` | no | -90 to 90. |
| `lng` | `number \| null` | no | -180 to 180. |
| `azimuth` | `number \| null` | no |  |
| `released` | `boolean` | no |  |
| `expendable` | `boolean` | no |  |
| `allowFailure` | `boolean` | no |  |
| `metadata` | `Record<string, unknown> \| null` | no | A record of key-value pairs containing additional metadata about the entity. |
| `description` | `string \| null` | no | Up to 1024 characters. |
| `pictureURL` | `string (uri) \| null` | no |  |

Response 200: The updated job.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `Job` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 |  | Invalid body. |
| 400 | `GET_NODE_NOT_FOUND` | The job has no node with this name. |
| 400 | `UPDATE_NODE_NAME_NOT_PENDING` | Renaming a node that is not pending. |
| 400 | `UPDATE_NODE_NAME_DUPLICATE` | The new name is taken by another node. |
| 400 | `UPDATE_NODE_POSITION_NOT_PENDING` | Moving a node that is neither pending nor the current one. |
| 400 | `UPDATE_NODE_POSITION_ARRIVED` | Moving a node the bot already arrived at. |
| 400 | `POINT_NOT_FOUND` | `pointId` is not a point of the job location. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |

Example request:

```json
{
  "lat": 4.6605,
  "lng": -74.0525
}
```

### Delete a node

`DELETE /engine/jobs/{jobId}/nodes/{nodeName}` (scope `engine`)

On an active job, only a pending node can be deleted.

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `jobId` | `string` | yes | Job id. |
| `nodeName` | `string` | yes | Node name. |

Response 200: The updated job.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `Job` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 | `GET_NODE_NOT_FOUND` | The job has no node with this name. |
| 400 | `DELETE_NODE_NOT_PENDING` | The job is active and the node is not pending. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |

### Release a held node

`POST /engine/jobs/{jobId}/nodes/{nodeName}/release` (scope `engine`)

Lets the job move on from a node created with `released` false.

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `jobId` | `string` | yes | Job id. |
| `nodeName` | `string` | yes | Node name. |

Response 200: The updated job.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `Job` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 | `GET_NODE_NOT_FOUND` | The job has no node with this name. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |

### Mark a node as arrived

`POST /engine/jobs/{jobId}/nodes/{nodeName}/arrive` (scope `engine`)

Records that the bot reached the node. The node must be in progress and have coordinates.

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `jobId` | `string` | yes | Job id. |
| `nodeName` | `string` | yes | Node name. |

Response 200: The updated job.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `Job` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 | `GET_NODE_NOT_FOUND` | The job has no node with this name. |
| 400 | `ARRIVE_NODE_NOT_IN_PROGRESS` | The node is not in progress. |
| 400 | `ARRIVE_NODE_ALREADY_ARRIVED` | The node already has an arrival. |
| 400 | `ARRIVE_NODE_NO_POSITION` | The node has no coordinates. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |

### Update travel estimates

`POST /engine/jobs/{jobId}/nodes/{nodeName}/update-estimations` (scope `engine`)

Sets the travel time to a node the bot is driving to. The node must be in progress, departed and not yet arrived.

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `jobId` | `string` | yes | Job id. |
| `nodeName` | `string` | yes | Node name. |

Body:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `newTravelDuration` | `number` | yes | New estimated travel time to the node, in milliseconds. |
| `arriving` | `boolean` | yes | True when the bot is about to arrive. The node then becomes `arriving`. |

Response 200: Whether the node became `arriving`.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `object` | yes |  |
| `data.arriving` | `boolean` | yes | True when this call moved the node to `arriving`. |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 |  | Invalid body. |
| 400 | `GET_NODE_NOT_FOUND` | The job has no node with this name. |
| 400 | `UPDATE_NODE_ESTIMATIONS_INVALID_STATE` | The node is not in progress, has not departed, or already arrived. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |

Example request:

```json
{
  "newTravelDuration": 45000,
  "arriving": true
}
```

Example response:

```json
{
  "data": {
    "arriving": true
  }
}
```

## Actions

What happens at a node, such as loading or unloading a package.

### Add an action

`POST /engine/jobs/{jobId}/nodes/{nodeName}/actions` (scope `engine`)

Adds an action to a node, not before the actions that already started.

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `jobId` | `string` | yes | Job id. |
| `nodeName` | `string` | yes | Node name. |

Body:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `action` | `NewAction` | yes |  |
| `atIndex` | `number` | no | Position to insert the action at. Default: the end. |

Response 201: The updated job.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `Job` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 |  | Invalid body. |
| 400 | `GET_NODE_NOT_FOUND` | The job has no node with this name. |
| 400 | `ADD_ACTION_NAME_DUPLICATE` | The node already has an action with this name. |
| 400 | `ADD_ACTION_INDEX_OUT_OF_BOUNDS` | `atIndex` is outside the node actions. |
| 400 | `ADD_ACTION_NODE_IN_PAST` | The node is before the current one. |
| 400 | `ADD_ACTION_BEFORE_CURRENT` | `atIndex` is before an action that already started. |
| 400 | `ADD_ACTION_PACKAGE_NOT_FOUND` | `packageName` is not a package of the job. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |

Example request:

```json
{
  "action": {
    "name": "unload-2",
    "type": "unload",
    "packageName": "pkg-2"
  }
}
```

### Update an action

`PATCH /engine/jobs/{jobId}/nodes/{nodeName}/actions/{actionName}` (scope `engine`)

An action can be renamed only while pending.

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `jobId` | `string` | yes | Job id. |
| `nodeName` | `string` | yes | Node name. |
| `actionName` | `string` | yes | Action name. |

Body:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | `string` | no | The name of the entity. Must only contain alphanumeric characters, underscores, and hyphens. Up to 255 characters. |
| `type` | `string` | no | Up to 255 characters. |
| `packageName` | `string \| null` | no |  |
| `bundleName` | `string \| null` | no | The name of the entity. Must only contain alphanumeric characters, underscores, and hyphens. Up to 255 characters. |
| `blockingType` | `'soft' \| 'hard'` | no |  |
| `allowFailure` | `boolean` | no |  |
| `metadata` | `Record<string, unknown> \| null` | no | A record of key-value pairs containing additional metadata about the entity. |

Response 200: The updated job.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `Job` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 |  | Invalid body. |
| 400 | `GET_NODE_NOT_FOUND` | The job has no node with this name. |
| 400 | `GET_ACTION_NOT_FOUND` | The node has no action with this name. |
| 400 | `UPDATE_ACTION_NAME_NOT_PENDING` | Renaming an action that is not pending. |
| 400 | `UPDATE_ACTION_NAME_DUPLICATE` | The new name is taken by another action of the node. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |

### Delete an action

`DELETE /engine/jobs/{jobId}/nodes/{nodeName}/actions/{actionName}` (scope `engine`)

On an active job, only a pending action can be deleted.

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `jobId` | `string` | yes | Job id. |
| `nodeName` | `string` | yes | Node name. |
| `actionName` | `string` | yes | Action name. |

Response 200: The updated job.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `Job` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 | `GET_NODE_NOT_FOUND` | The job has no node with this name. |
| 400 | `GET_ACTION_NOT_FOUND` | The node has no action with this name. |
| 400 | `DELETE_ACTION_NOT_PENDING` | The job is active and the action is not pending. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |

### Complete an action

`POST /engine/jobs/{jobId}/nodes/{nodeName}/actions/{actionName}/complete` (scope `engine`)

The action must be in progress. When it was the last one of the node, the job moves on.

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `jobId` | `string` | yes | Job id. |
| `nodeName` | `string` | yes | Node name. |
| `actionName` | `string` | yes | Action name. |

Response 200: The updated job.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `Job` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 | `GET_NODE_NOT_FOUND` | The job has no node with this name. |
| 400 | `GET_ACTION_NOT_FOUND` | The node has no action with this name. |
| 400 | `COMPLETE_ACTION_NOT_IN_PROGRESS` | The action is not in progress. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |

### Fail an action

`POST /engine/jobs/{jobId}/nodes/{nodeName}/actions/{actionName}/fail` (scope `engine`)

The action must be in progress.

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `jobId` | `string` | yes | Job id. |
| `nodeName` | `string` | yes | Node name. |
| `actionName` | `string` | yes | Action name. |

Body (optional):

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `reason` | `string` | no | Why. Stored in the action `metadata.finalizationReason` unless one is already set. |

Response 200: The updated job.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `Job` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 |  | Invalid body. |
| 400 | `GET_NODE_NOT_FOUND` | The job has no node with this name. |
| 400 | `GET_ACTION_NOT_FOUND` | The node has no action with this name. |
| 400 | `FAIL_ACTION_NOT_IN_PROGRESS` | The action is not in progress. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |

### Skip an action

`POST /engine/jobs/{jobId}/nodes/{nodeName}/actions/{actionName}/skip` (scope `engine`)

The action must be pending or in progress.

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `jobId` | `string` | yes | Job id. |
| `nodeName` | `string` | yes | Node name. |
| `actionName` | `string` | yes | Action name. |

Body (optional):

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `reason` | `string` | no | Why. Stored in the action `metadata.finalizationReason` unless one is already set. |

Response 200: The updated job.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `Job` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 |  | Invalid body. |
| 400 | `GET_NODE_NOT_FOUND` | The job has no node with this name. |
| 400 | `GET_ACTION_NOT_FOUND` | The node has no action with this name. |
| 400 | `SKIP_ACTION_INVALID_STATE` | The action is neither pending nor in progress. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |

### Cancel an action

`POST /engine/jobs/{jobId}/nodes/{nodeName}/actions/{actionName}/cancel` (scope `engine`)

The action must be pending, in progress or paused.

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `jobId` | `string` | yes | Job id. |
| `nodeName` | `string` | yes | Node name. |
| `actionName` | `string` | yes | Action name. |

Body (optional):

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `reason` | `string` | no | Why. Stored in the action `metadata.finalizationReason` unless one is already set. |

Response 200: The updated job.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `Job` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 |  | Invalid body. |
| 400 | `GET_NODE_NOT_FOUND` | The job has no node with this name. |
| 400 | `GET_ACTION_NOT_FOUND` | The node has no action with this name. |
| 400 | `CANCEL_ACTION_INVALID_STATE` | The action is already finished. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |

### Confirm a package is loaded

`POST /engine/jobs/{jobId}/nodes/{nodeName}/actions/{actionName}/load` (scope `engine`)

Closes the bot door, optionally verifies the package is inside, then completes the `load` action. Call it after the package is in the bot. The action must be in progress.

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `jobId` | `string` | yes | Job id. |
| `nodeName` | `string` | yes | Node name. |
| `actionName` | `string` | yes | Action name. |

Body (optional):

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `skipCloseDoor` | `boolean` | no | Do not close the door first. |
| `allowDoorClosingFailure` | `boolean` | no | Go on when the door cannot be closed. The result tells whether it failed. |
| `verification` | `'vri' \| null` | no | `vri`: check with the bot first that the package is inside (load) or gone (unload). If the check fails, the action stays in progress. |

Response 200: The result.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `LoadUnloadResult` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 |  | Invalid body. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |
| 404 | `NODE_NOT_FOUND` | The job has no node with this name. |
| 404 | `ACTION_NOT_FOUND` | The node has no action with this name. |
| 409 | `CANNOT_LOAD_ACTION_NOT_IN_PROGRESS` | The action is not in progress. |
| 409 | `CANNOT_LOAD_ACTION_NOT_LOAD_OR_UNLOAD` | The action type is not `load` or `unload`. |
| 409 | `NO_BOT_ASSIGNED` | The job has no bot. |
| 409 | `CANNOT_CLOSE_DOOR` | The door did not close and `allowDoorClosingFailure` is not set. |

Example request:

```json
{
  "verification": "vri"
}
```

Example response:

```json
{
  "data": {
    "success": true,
    "doorClosedFailed": false,
    "botId": "4T001",
    "verificationResult": "success"
  }
}
```

### Confirm a package is unloaded

`POST /engine/jobs/{jobId}/nodes/{nodeName}/actions/{actionName}/unload` (scope `engine`)

Closes the bot door, optionally verifies the package is gone, then completes the `unload` action. Call it after the package is out of the bot. The action must be in progress.

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `jobId` | `string` | yes | Job id. |
| `nodeName` | `string` | yes | Node name. |
| `actionName` | `string` | yes | Action name. |

Body (optional):

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `skipCloseDoor` | `boolean` | no | Do not close the door first. |
| `allowDoorClosingFailure` | `boolean` | no | Go on when the door cannot be closed. The result tells whether it failed. |
| `verification` | `'vri' \| null` | no | `vri`: check with the bot first that the package is inside (load) or gone (unload). If the check fails, the action stays in progress. |

Response 200: The result.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `LoadUnloadResult` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 |  | Invalid body. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |
| 404 | `NODE_NOT_FOUND` | The job has no node with this name. |
| 404 | `ACTION_NOT_FOUND` | The node has no action with this name. |
| 409 | `CANNOT_LOAD_ACTION_NOT_IN_PROGRESS` | The action is not in progress. |
| 409 | `CANNOT_LOAD_ACTION_NOT_LOAD_OR_UNLOAD` | The action type is not `load` or `unload`. |
| 409 | `NO_BOT_ASSIGNED` | The job has no bot. |
| 409 | `CANNOT_CLOSE_DOOR` | The door did not close and `allowDoorClosingFailure` is not set. |

## Packages

The packages a job carries.

### Add a package

`POST /engine/jobs/{jobId}/packages` (scope `engine`)

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `jobId` | `string` | yes | Job id. |

Body:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | `string` | yes | The name of the package. Must be unique per job. Up to 255 characters. |
| `bundleName` | `string \| null` | no | Group identifier for the package. Up to 255 characters. |
| `description` | `string \| null` | no | A description in markdown format. Up to 1024 characters. |
| `pictureURL` | `string (uri) \| null` | no | URL of a picture of the package. |
| `items` | `{ name: string, quantity: number } & Record<string, unknown>[] \| null` | no | What is inside. Each item needs `name` and `quantity` (at least 1); other fields are kept. |
| `metadata` | `Record<string, unknown> \| null` | no | A record of key-value pairs containing additional metadata about the entity. |
| `station` | `string \| null` | no | Prep station that owns this package (e.g. "Burger Shop"). Trimmed; blank becomes null. |

Response 201: The updated job.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `Job` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 |  | Invalid body. |
| 400 | `ADD_PACKAGE_NAME_DUPLICATE` | The job already has a package with this name. |
| 400 | `STATIONED_PACKAGES_REQUIRE_PER_PACKAGE_LOAD` | A load action without `packageName` would cover packages of more than one station. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |

Example request:

```json
{
  "name": "pkg-2",
  "station": "Drinks",
  "items": [
    {
      "name": "Lemonade",
      "quantity": 2
    }
  ]
}
```

### Update a package

`PATCH /engine/jobs/{jobId}/packages/{packageName}` (scope `engine`)

A package can be renamed only while none of its actions started.

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `jobId` | `string` | yes | Job id. |
| `packageName` | `string` | yes | Package name. |

Body:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | `string` | no | The name of the entity. Must only contain alphanumeric characters, underscores, and hyphens. Up to 255 characters. |
| `bundleName` | `string \| null` | no | The name of the entity. Must only contain alphanumeric characters, underscores, and hyphens. Up to 255 characters. |
| `description` | `string \| null` | no | Up to 1024 characters. |
| `pictureURL` | `string (uri) \| null` | no |  |
| `items` | `{ name: string, quantity: number } & Record<string, unknown>[] \| null` | no |  |
| `metadata` | `Record<string, unknown> \| null` | no | A record of key-value pairs containing additional metadata about the entity. |
| `station` | `string \| null` | no | Prep station that owns this package. Trimmed; blank becomes null. |

Response 200: The updated job.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `Job` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 |  | Invalid body. |
| 400 | `GET_PACKAGE_NOT_FOUND` | The job has no package with this name. |
| 400 | `UPDATE_PACKAGE_NAME_DUPLICATE` | The new name is taken by another package. |
| 400 | `UPDATE_PACKAGE_NAME_IN_USE` | Renaming a package whose actions already started. |
| 400 | `STATIONED_PACKAGES_REQUIRE_PER_PACKAGE_LOAD` | A load action without `packageName` would cover packages of more than one station. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |

### Delete a package

`DELETE /engine/jobs/{jobId}/packages/{packageName}` (scope `engine`)

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `jobId` | `string` | yes | Job id. |
| `packageName` | `string` | yes | Package name. |

Response 200: The updated job.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `Job` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 | `GET_PACKAGE_NOT_FOUND` | The job has no package with this name. |
| 400 | `DELETE_PACKAGE_IN_USE` | An action that uses the package already started. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |

## Hooks

Calls a webhook, or runs another action, when job events match its filters.

### Add a hook

`POST /engine/jobs/{jobId}/hooks` (scope `engine`)

The hook fires on every event that matches its filters. A filter you leave out matches everything.

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `jobId` | `string` | yes | Job id. |

Body:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | `string` | yes | The name of the hook. Must be unique per job. Up to 255 characters. |
| `eventType` | `enum[] \| null` | no | Fire only for these event types. Omit for all. |
| `nodeName` | `string[] \| null` | no | Filter events to specific nodes by their names. |
| `actionName` | `string[] \| null` | no | Filter events to specific actions by their names. |
| `packageName` | `string[] \| null` | no | Filter events to specific packages by their names. |
| `jobState` | `enum[] \| null` | no | Fire only while the job is in one of these states. Omit for all. |
| `action` | `'call_webhook'` | no | Only `call_webhook`. Inferred from an `https://` or `http://` `target` when omitted. |
| `target` | `string` | no | The URL to call. |
| `queueName` | `string \| null` | no | Serialization queue for this hook, scoped to the job. Hooks of the same job sharing a queue name execute one at a time in event order, and a failing hook retries to its limit before the next one runs. Omit for the default concurrent dispatch. Up to 255 characters. |
| `metadata` | `Record<string, unknown> \| null` | no | Extra settings for the action. For `call_webhook`: `{ "webhook": { "method": "POST", "headers": { "X-Key": "value" } } }`. `method` is POST, GET, PATCH or PUT; send both `method` and `headers`, or the defaults apply (POST, no extra headers). |

Response 201: The created hook.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `Hook` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 |  | Invalid body. |
| 400 | `HOOK_ACTION_AND_TARGET_UNDEFINED` | No `action`, and `target` has no recognizable scheme. |
| 400 | `HOOK_ACTION_NOT_ALLOWED` | `action` is not `call_webhook`, or `target` is not an `http(s)` URL. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |
| 409 | `DUPLICATE_HOOK_NAME` | The job already has a hook with this name. |

Example request:

```json
{
  "name": "notify-partner",
  "target": "https://example.com/hooks/engine",
  "eventType": [
    "job_started",
    "job_finalized"
  ]
}
```

Example response:

```json
{
  "data": {
    "jobId": "ES-5867",
    "name": "notify-partner",
    "eventType": [
      "job_started",
      "job_finalized"
    ],
    "nodeName": null,
    "actionName": null,
    "actionType": null,
    "packageName": null,
    "jobState": null,
    "action": "call_webhook",
    "target": "https://example.com/hooks/engine",
    "queueName": null,
    "metadata": null
  }
}
```

### Update a hook

`PATCH /engine/jobs/{jobId}/hooks/{hookName}` (scope `engine`)

Send only what changes. The name cannot change.

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `jobId` | `string` | yes | Job id. |
| `hookName` | `string` | yes | Hook name. |

Body:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `eventType` | `enum[] \| null` | no | Fire only for these event types. Omit for all. |
| `nodeName` | `string[] \| null` | no | Filter events to specific nodes by their names. |
| `actionName` | `string[] \| null` | no | Filter events to specific actions by their names. |
| `packageName` | `string[] \| null` | no | Filter events to specific packages by their names. |
| `jobState` | `enum[] \| null` | no | Fire only while the job is in one of these states. Omit for all. |
| `action` | `'call_webhook'` | no | Only `call_webhook`. Inferred from an `https://` or `http://` `target` when omitted. |
| `target` | `string` | no | The URL to call. |
| `queueName` | `string \| null` | no | Serialization queue for this hook, scoped to the job. Hooks of the same job sharing a queue name execute one at a time in event order, and a failing hook retries to its limit before the next one runs. Omit for the default concurrent dispatch. Up to 255 characters. |
| `metadata` | `Record<string, unknown> \| null` | no | Extra settings for the action. For `call_webhook`: `{ "webhook": { "method": "POST", "headers": { "X-Key": "value" } } }`. `method` is POST, GET, PATCH or PUT; send both `method` and `headers`, or the defaults apply (POST, no extra headers). |

Response 200: The updated hook.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `Hook` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 |  | Invalid body. |
| 400 | `HOOK_ACTION_NOT_ALLOWED` | `action` is not `call_webhook`, or `target` is not an `http(s)` URL. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |
| 404 | `HOOK_NOT_FOUND` | The job has no hook with this name. |

### Delete a hook

`DELETE /engine/jobs/{jobId}/hooks/{hookName}` (scope `engine`)

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `jobId` | `string` | yes | Job id. |
| `hookName` | `string` | yes | Hook name. |

Response 200: The hook was deleted.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `object` | yes |  |
| `data.deleted` | `boolean` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |
| 404 | `HOOK_NOT_FOUND` | The job has no hook with this name. |

Example response:

```json
{
  "data": {
    "deleted": true
  }
}
```

## Events

The history of what happened to a job.

### List the events of a job

`GET /engine/jobs/{jobId}/events` (scope `engine`)

Oldest first. Pass `pagination.next_cursor` as `cursor` to get the next page; it is null on the last page.

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `jobId` | `string` | yes | Job id. |

Query parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `limit` | `integer` | no | Page size, 1 to 50. Default 50. 1 to 50. Default `50`. |
| `cursor` | `string` | no | `next_cursor` of the previous page. |

Response 200: A page of events.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `Event[]` | yes |  |
| `pagination` | `object` | yes |  |
| `pagination.next_cursor` | `string \| null` | yes |  |
| `pagination.limit` | `number` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 |  | Invalid query, for example `limit` above 50. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |

Example response:

```json
{
  "data": [
    {
      "id": "019ed63f-1940-7c1a-9d3e-5b8f2a6e4c10",
      "jobId": "ES-5867",
      "namespace": "partner_example",
      "locationId": "7Nk2QhVpXrLmT4wZaBcDe",
      "jobVersion": 1,
      "sequence": 0,
      "jobState": "pending",
      "botId": null,
      "nodeName": null,
      "actionName": null,
      "packageName": null,
      "eventType": "job_created",
      "path": "jobs.partner_example.ES-5867.created",
      "operation": "create_job",
      "user": null,
      "metadata": {
        "job": {
          "id": "ES-5867",
          "namespace": "partner_example",
          "locationId": "7Nk2QhVpXrLmT4wZaBcDe",
          "state": "pending",
          "botId": null,
          "requiresBot": true,
          "version": 1
        }
      },
      "exportedAt": null,
      "createdAt": "2026-06-17T15:42:00.000Z"
    }
  ],
  "pagination": {
    "next_cursor": null,
    "limit": 50
  }
}
```

## Alerts

Problems raised on a job.

### List the alerts of a job

`GET /engine/jobs/{jobId}/alerts` (scope `engine`)

Oldest first. Pass `pagination.next_cursor` as `cursor` to get the next page; it is null on the last page.

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `jobId` | `string` | yes | Job id. |

Query parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `limit` | `integer` | no | Page size, 1 to 100. Default 50. 1 to 100. Default `50`. |
| `cursor` | `string` | no | `next_cursor` of the previous page. |
| `name` | `string` | no | Only alerts with this name. |

Response 200: A page of alerts.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `Alert[]` | yes |  |
| `pagination` | `object` | yes |  |
| `pagination.next_cursor` | `string \| null` | yes |  |
| `pagination.limit` | `number` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 |  | Invalid query, for example `limit` above 100. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |

### Raise an alert on a job

`POST /engine/jobs/{jobId}/alerts` (scope `engine`)

The location, bot and job version are filled in from the job.

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `jobId` | `string` | yes | Job id. |

Body:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | `string` | yes | Category of the alert. |
| `description` | `string` | yes | Markdown. |
| `priority` | `integer` | no | From 0 (lowest) to 100 (highest). Default 0. 0 to 100. Default `0`. |
| `metadata` | `Record<string, unknown> \| null` | no |  |

Response 201: The created alert.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `Alert` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 |  | Invalid body. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |

Example request:

```json
{
  "name": "pickup-delay",
  "description": "The kitchen is 10 minutes late.",
  "priority": 50
}
```

Example response:

```json
{
  "data": {
    "id": "019ed641-6330-7e2f-b5a1-3c7d9e0f4a68",
    "jobId": "ES-5867",
    "locationId": "7Nk2QhVpXrLmT4wZaBcDe",
    "namespace": "partner_example",
    "botId": "4T001",
    "jobVersion": 4,
    "name": "pickup-delay",
    "description": "The kitchen is 10 minutes late.",
    "priority": 50,
    "eventType": null,
    "eventPath": null,
    "eventId": null,
    "eventData": null,
    "createdAt": "2026-06-17T15:44:30.000Z",
    "metadata": null
  }
}
```

### List alerts across jobs

`GET /engine/alerts` (scope `engine`)

Newest first by default. Send `next_cursor.id` as `cursor_id` and `next_cursor.created_at` as `cursor_created_at` to get the next page. `next_cursor` is null on the last page.

Query parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `limit` | `integer` | no | Page size, 1 to 100. Default 50. 1 to 100. Default `50`. |
| `cursor_id` | `string` | no | `next_cursor.id` of the previous page. Send it with `cursor_created_at`. |
| `cursor_created_at` | `string` | no | `next_cursor.created_at` of the previous page. Send it with `cursor_id`. |
| `order` | `'asc' \| 'desc'` | no | By creation time. Default `desc`. Default `"desc"`. |
| `locations` | `string` | no | Comma-separated location ids. Only jobs at these locations. |
| `name` | `string` | no | Only alerts with this name. |

Response 200: A page of alerts.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `Alert[]` | yes |  |
| `pagination` | `object` | yes |  |
| `pagination.next_cursor` | `object \| null` | yes |  |
| `pagination.next_cursor.id` | `string` | yes |  |
| `pagination.next_cursor.created_at` | `string` | yes |  |
| `pagination.limit` | `number` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 |  | Invalid query, for example `limit` above 100. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |

Example response:

```json
{
  "data": [
    {
      "id": "019ed641-6330-7e2f-b5a1-3c7d9e0f4a68",
      "jobId": "ES-5867",
      "locationId": "7Nk2QhVpXrLmT4wZaBcDe",
      "namespace": "partner_example",
      "botId": "4T001",
      "jobVersion": 4,
      "name": "pickup-delay",
      "description": "The kitchen is 10 minutes late.",
      "priority": 50,
      "eventType": null,
      "eventPath": null,
      "eventId": null,
      "eventData": null,
      "createdAt": "2026-06-17T15:44:30.000Z",
      "metadata": null
    }
  ],
  "pagination": {
    "next_cursor": {
      "id": "019ed641-6330-7e2f-b5a1-3c7d9e0f4a68",
      "created_at": "2026-06-17T15:44:30.000Z"
    },
    "limit": 1
  }
}
```

## Bots

Control a bot directly: its door and its screen.

### Open or close the door during an action

`POST /engine/jobs/{jobId}/nodes/{nodeName}/actions/{actionName}/door` (scope `engine`)

Moves the door of the job bot. The job must be active with a bot, and the action in progress.

Waits for the door to reach the requested state, up to 25 seconds per attempt, with two attempts. A door that does not move is still a 200: read `success` and `failureReason`.

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `jobId` | `string` | yes | Job id. |
| `nodeName` | `string` | yes | Node name. |
| `actionName` | `string` | yes | Action name. |

Body:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `state` | `'open' \| 'closed'` | yes | The door state to reach. |

Response 200: The door result.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `DoorResult` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 |  | Invalid body. |
| 400 |  | The job is not in progress or paused, has no bot, or the action is not in progress. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |
| 404 |  | The node has no action with this name. |

Example request:

```json
{
  "state": "open"
}
```

Example response:

```json
{
  "data": {
    "success": true,
    "missionCreated": false,
    "failureReason": null,
    "lastDoorState": "opened"
  }
}
```

### Open or close a bot door

`POST /engine/bots/{botId}/actions/door` (scope `engine`)

Waits for the door to reach the requested state, up to 25 seconds per attempt, with two attempts. A door that does not move is still a 200: read `success` and `failureReason`.

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `botId` | `string` | yes | Bot id, for example `4T001`. |

Body:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `state` | `'open' \| 'closed'` | yes | The door state to reach. |

Response 200: The door result.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `DoorResult` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 |  | Invalid body. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 403 |  | The bot is not one of yours and has no active job of yours. |
| 404 |  | No bot with this id. |

Example request:

```json
{
  "state": "closed"
}
```

Example response:

```json
{
  "data": {
    "success": false,
    "missionCreated": false,
    "failureReason": "timeout",
    "lastDoorState": "closing"
  }
}
```

### Play a screen animation

`POST /engine/bots/{botId}/actions/animation` (scope `engine`)

Sent to the bot without waiting for it to play.

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `botId` | `string` | yes | Bot id, for example `4T001`. |

Body:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `animationId` | `integer` | yes | Screen animation id. Known: 2 to 14 (dark background) and 15 to 27 (white background). 0 to 9007199254740991. |
| `keepFixed` | `boolean` | no | Keep the animation on the screen. Default true. Default `true`. |

Response 200: The animation was sent.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `object` | yes |  |
| `data.success` | `boolean` | yes |  |
| `data.botId` | `string` | yes |  |
| `data.action` | `string` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 |  | Invalid body. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 403 |  | The bot is not one of yours and has no active job of yours. |
| 404 |  | No bot with this id. |

Example request:

```json
{
  "animationId": 5,
  "keepFixed": true
}
```

Example response:

```json
{
  "data": {
    "success": true,
    "botId": "4T001",
    "action": "animation"
  }
}
```

### Open or close the door of a job bot

`POST /engine/jobs/{jobId}/bot/actions/door` (scope `engine`)

The job must be in progress or paused, with a bot.

Waits for the door to reach the requested state, up to 25 seconds per attempt, with two attempts. A door that does not move is still a 200: read `success` and `failureReason`.

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `jobId` | `string` | yes | Job id. |

Body:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `state` | `'open' \| 'closed'` | yes | The door state to reach. |

Response 200: The door result.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `DoorResult` | yes |  |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 400 |  | Invalid body. |
| 400 |  | The job is not in progress or paused, or has no bot. |
| 401 |  | Missing or invalid API key. |
| 403 |  | The API key does not have the `engine` scope. |
| 404 |  | No job with this id in your namespace. |

Example request:

```json
{
  "state": "open"
}
```

## Types

### Problem

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `type` | `string` | yes | Always `about:blank`. |
| `title` | `string` | yes | The HTTP status text. |
| `status` | `integer` | yes | -9007199254740991 to 9007199254740991. |
| `detail` | `string` | yes | Human-readable. Do not parse it: branch on `code`. |
| `instance` | `string` | yes | The request path. |
| `code` | `string` | no | Stable machine-readable error code, when the error has one. |
| `params` | `Record<string, unknown>` | no | Values that explain the error, keyed by name. |

### Job

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | yes | Job id, usually like `ES-5867`. Treat it as an opaque string. |
| `namespace` | `string` | yes | The namespace that owns the job. |
| `externalId` | `string \| null` | yes | Your own reference. Unique among your active jobs. |
| `locationId` | `string` | yes |  |
| `version` | `number` | yes | Increases by one on every change. Send the current value plus one as `nextVersion` to reject concurrent edits. |
| `name` | `string` | yes |  |
| `description` | `string \| null` | yes | Markdown. |
| `pictureURL` | `string \| null` | yes |  |
| `assignation` | `'auto' \| 'manual'` | yes | `auto`: a bot is assigned for you. `manual`: you assign it. |
| `start` | `'auto' \| 'manual'` | yes | `auto`: starts once a bot is assigned and free. `manual`: waits for the start route. |
| `state` | `JobState` | yes |  |
| `currentNodeIndex` | `number \| null` | yes | `index` of the node in progress. Null until the job starts. |
| `priority` | `number` | yes | From 0 (lowest) to 100 (highest). |
| `expendable` | `boolean` | yes | True if the job can be ended early to free its bot without counting as failed. |
| `createdManually` | `boolean` | yes | True when a person created the job in the REMI app, false when it came from the API. |
| `scheduledAt` | `string (date-time) \| null` | yes | When the job should reach its first node. |
| `targetCompletionAt` | `string (date-time) \| null` | yes | When the job is expected to finish. |
| `startedAt` | `string (date-time) \| null` | yes |  |
| `finalizedAt` | `string (date-time) \| null` | yes | When the job reached a final state. |
| `botId` | `string \| null` | yes | The assigned bot, for example `4T001`. |
| `requiresBot` | `boolean` | yes | False for a job that runs without a bot. |
| `requiredBotTags` | `string[] \| null` | yes | Only bots with every one of these tags can take the job. Null or empty: any bot. |
| `createdAt` | `string (date-time)` | yes |  |
| `updatedAt` | `string (date-time) \| null` | yes |  |
| `tags` | `string[] \| null` | yes |  |
| `metadata` | `unknown` | yes | Free-form JSON object, or null. |
| `nodes` | `Node[]` | yes | In visiting order. |
| `hooks` | `Hook[]` | no | Only with `include_hooks=true`. |
| `alerts` | `Alert[]` | no | Only with `include_alerts=true`. |
| `packages` | `Package[]` | yes |  |
| `events` | `Event[]` | no | Only with `include_events=true`. |

### JobState

`draft`: being prepared, never auto-assigned or started. `scheduled`: waits for its time. `pending`: ready to be assigned and started. `in_progress`: a bot is working on it. `paused`: on hold. `completed`, `failed` and `canceled` are final.

### Node

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `jobId` | `string` | yes |  |
| `name` | `string` | yes | Unique within the job. |
| `description` | `string \| null` | yes | Markdown. |
| `pictureURL` | `string \| null` | yes |  |
| `index` | `number` | yes | Position in the job, from 0. |
| `pointId` | `string \| null` | yes | The registered point this node was created from, if any. |
| `lat` | `number \| null` | yes |  |
| `lng` | `number \| null` | yes |  |
| `azimuth` | `number \| null` | yes |  |
| `positionIndex` | `number \| null` | yes | Position among the nodes that have coordinates. |
| `hasPositionDefined` | `boolean` | yes | True when `lat` and `lng` are set. |
| `distance` | `number` | yes | Estimated distance to the next node. |
| `travelDuration` | `number` | yes | Estimated travel time to this node, in milliseconds. |
| `actionsDuration` | `number` | yes | Estimated time of the actions at this node, in milliseconds. |
| `totalDuration` | `number` | yes | Estimated time at this node in milliseconds: travel plus the actions that cannot run in parallel. |
| `estimatedArrivalAt` | `string (date-time) \| null` | yes | Estimated arrival, or the real one once the bot arrived. It can be stale between updates. |
| `startedAt` | `string (date-time) \| null` | yes |  |
| `departedAt` | `string (date-time) \| null` | yes | When the bot left for this node. |
| `arrivedAt` | `string (date-time) \| null` | yes | When the bot arrived at this node. |
| `finalizedAt` | `string (date-time) \| null` | yes |  |
| `state` | `NodeState` | yes |  |
| `transitState` | `'in_transit' \| 'arriving' \| 'interrupted' \| null` | yes | `in_transit`: the bot is driving here. `arriving`: it is close. `interrupted`: the leg was abandoned. |
| `allowFailure` | `boolean` | yes | The job continues if this node fails. |
| `expendable` | `boolean` | yes | The job can be ended early at this node without counting as failed. |
| `tags` | `string[] \| null` | yes |  |
| `released` | `boolean` | yes | If false, the node waits for the release route before the job moves on. |
| `metadata` | `unknown` | yes | Free-form JSON object, or null. |
| `actions` | `Action[]` | yes | In execution order. |

### NodeState

### Action

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `jobId` | `string` | yes |  |
| `nodeName` | `string` | yes |  |
| `name` | `string` | yes | Unique within the node. |
| `index` | `number` | yes | Position in the node, from 0. |
| `type` | `string` | yes | What the action does. `load` and `unload` are handled by the engine; other values are free-form. |
| `blockingType` | `'hard' \| 'soft'` | yes | `hard` blocks the movement and the other actions. `soft` blocks only the movement. |
| `state` | `ActionState` | yes |  |
| `allowFailure` | `boolean` | yes | The job continues if this action fails. |
| `packageName` | `string \| null` | yes | For `load` and `unload`: the package it handles. |
| `bundleName` | `string \| null` | yes | For `load` and `unload`: handles every package of this bundle instead of one package. |
| `metadata` | `unknown` | yes | Free-form JSON object, or null. |
| `startedAt` | `string (date-time) \| null` | yes |  |
| `finalizedAt` | `string (date-time) \| null` | yes |  |
| `duration` | `number` | yes | Estimated duration in milliseconds. |
| `createdAt` | `string (date-time)` | yes |  |
| `updatedAt` | `string (date-time) \| null` | yes |  |

### ActionState

### Package

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `jobId` | `string` | yes |  |
| `name` | `string` | yes | Unique within the job. |
| `bundleName` | `string \| null` | yes | Group identifier. |
| `description` | `string \| null` | yes | Markdown. |
| `pictureURL` | `string \| null` | yes |  |
| `items` | `{ name: string, quantity: number }[] \| null` | yes |  |
| `items[].name` | `string` | yes |  |
| `items[].quantity` | `number` | yes |  |
| `metadata` | `Record<string, unknown> \| null` | yes |  |
| `station` | `string \| null` | yes | Prep station that owns the package. |
| `createdAt` | `string (date-time)` | yes |  |

### Hook

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `jobId` | `string` | yes |  |
| `name` | `string` | yes | Unique within the job. |
| `eventType` | `enum[] \| null` | yes | Fires only for these event types. Null: all. |
| `nodeName` | `string[] \| null` | yes | Fires only for these nodes. Null: all. |
| `actionName` | `string[] \| null` | yes | Fires only for these actions. Null: all. |
| `actionType` | `string[] \| null` | yes | Fires only for these action types. Null: all. |
| `packageName` | `string[] \| null` | yes | Fires only for these packages. Null: all. |
| `jobState` | `string[] \| null` | yes | Fires only while the job is in one of these states. Null: all. |
| `action` | `string` | yes | What the hook does, for example `call_webhook`. |
| `target` | `string \| null` | yes | Where the action delivers, for example a URL. |
| `queueName` | `string \| null` | yes | Hooks of the same job that share a queue name run one at a time, in event order. Null: they run concurrently. |
| `metadata` | `unknown` | yes | Settings for the action, or null. |

### Event

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string (uuid)` | yes | Time-ordered: events sort by `id`. |
| `jobId` | `string \| null` | yes |  |
| `namespace` | `string \| null` | yes |  |
| `locationId` | `string \| null` | yes |  |
| `jobVersion` | `number \| null` | yes | The job `version` when the event happened. |
| `sequence` | `number` | yes | Orders events that share a timestamp and a job version. |
| `jobState` | `string \| null` | yes |  |
| `botId` | `string \| null` | yes |  |
| `nodeName` | `string \| null` | yes |  |
| `actionName` | `string \| null` | yes |  |
| `packageName` | `string \| null` | yes |  |
| `eventType` | `enum` | yes | One of `job_created`, `job_updated`, `job_deleted`, `job_bot_assigned`, `job_bot_unassigned`, `job_scheduled`, `job_pending`, `job_started`, `job_paused`, `job_resumed`, `job_finalized`, `job_canceled`, `job_failed`, `job_completed`, `job_state_changed`, `bot_set_goal_failed`, `bot_taken`, `bot_released`, `bot_stopped`, `bot_goal_set`, `bot_goal_registered`, `bot_teleop_mission_created`, `door_opened`, `door_closed`, `door_state_change_failed`, `door_stalled`, `door_blocked_charging`, `node_added`, `node_updated`, `node_deleted`, `node_state_changed`, `node_started`, `node_departed`, `node_arriving`, `node_eta_changed`, `node_arrived`, `node_arrived_far`, `node_released`, `node_completed`, `node_phase_completed`, `node_failed`, `action_added`, `action_updated`, `action_deleted`, `action_started`, `action_paused`, `action_resumed`, `action_completed`, `action_failed`, `action_skipped`, `action_canceled`, `alert_created`, `alert_updated`, `alert_deleted`, `hook_added`, `hook_updated`, `hook_deleted`, `hook_triggered`, `package_added`, `package_updated`, `package_deleted`, `package_loaded`, `package_unloaded`, `package_loaded_failed`, `package_unloaded_failed`, `refund_recorded`, `custom_event`, `assigner_executed`. |
| `path` | `string` | yes | Where the event happened, as a dotted path. |
| `operation` | `string \| null` | yes | The operation that caused it, for example `create_job`. |
| `user` | `string \| null` | yes | Who triggered the operation. |
| `metadata` | `unknown` | yes | Details of the event. Their shape depends on `eventType`. |
| `exportedAt` | `string (date-time) \| null` | yes | Deprecated. Null on current events. |
| `createdAt` | `string (date-time)` | yes |  |

### Alert

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string (uuid)` | yes |  |
| `jobId` | `string` | yes |  |
| `locationId` | `string` | yes |  |
| `namespace` | `string` | yes |  |
| `botId` | `string \| null` | yes |  |
| `jobVersion` | `number` | yes | The job `version` when the alert was raised. |
| `name` | `string` | yes | Category of the alert. |
| `description` | `string` | yes | Markdown. |
| `priority` | `number` | yes | From 0 (lowest) to 100 (highest). |
| `eventType` | `enum \| null` | yes | The event that raised the alert, if one did. One of `job_created`, `job_updated`, `job_deleted`, `job_bot_assigned`, `job_bot_unassigned`, `job_scheduled`, `job_pending`, `job_started`, `job_paused`, `job_resumed`, `job_finalized`, `job_canceled`, `job_failed`, `job_completed`, `job_state_changed`, `bot_set_goal_failed`, `bot_taken`, `bot_released`, `bot_stopped`, `bot_goal_set`, `bot_goal_registered`, `bot_teleop_mission_created`, `door_opened`, `door_closed`, `door_state_change_failed`, `door_stalled`, `door_blocked_charging`, `node_added`, `node_updated`, `node_deleted`, `node_state_changed`, `node_started`, `node_departed`, `node_arriving`, `node_eta_changed`, `node_arrived`, `node_arrived_far`, `node_released`, `node_completed`, `node_phase_completed`, `node_failed`, `action_added`, `action_updated`, `action_deleted`, `action_started`, `action_paused`, `action_resumed`, `action_completed`, `action_failed`, `action_skipped`, `action_canceled`, `alert_created`, `alert_updated`, `alert_deleted`, `hook_added`, `hook_updated`, `hook_deleted`, `hook_triggered`, `package_added`, `package_updated`, `package_deleted`, `package_loaded`, `package_unloaded`, `package_loaded_failed`, `package_unloaded_failed`, `refund_recorded`, `custom_event`, `assigner_executed`. |
| `eventPath` | `string \| null` | yes |  |
| `eventId` | `string \| null` | yes |  |
| `eventData` | `unknown` | yes | Data of the event that raised the alert, or null. |
| `createdAt` | `string (date-time)` | yes |  |
| `metadata` | `unknown` | yes | Free-form JSON object, or null. |

### JobOverview

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `total` | `number` | yes |  |
| `active` | `number` | yes | Draft, scheduled, pending, in progress and paused. |
| `draft` | `number` | yes |  |
| `scheduled` | `number` | yes |  |
| `pending` | `number` | yes |  |
| `in_progress` | `number` | yes |  |
| `paused` | `number` | yes |  |
| `completed` | `number` | yes |  |
| `failed` | `number` | yes |  |
| `canceled` | `number` | yes |  |
| `completedLast24h` | `number` | yes |  |
| `failedLast24h` | `number` | yes |  |

### DoorResult

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `success` | `boolean` | yes | True when the door reached the requested state. |
| `missionCreated` | `boolean` | yes | Always false from this API. |
| `failureReason` | `'stalled' \| 'timeout' \| 'wrong_state' \| 'charging' \| null` | yes | Null on success. `stalled`: the door is stuck. `timeout`: no answer in time. `wrong_state`: it ended in the opposite state. `charging`: the bot is on its charger. |
| `lastDoorState` | `string` | yes | The last door state the bot reported. |

### LoadUnloadResult

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `success` | `boolean` | yes | False when the `vri` check failed. The action stays in progress then. |
| `doorClosedFailed` | `boolean` | yes | True when the door could not be closed and `allowDoorClosingFailure` let the call go on. |
| `botId` | `string` | yes |  |
| `verificationResult` | `'success' \| 'failed' \| null` | yes | Null when no `verification` was requested. |

### NewNode

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | `string` | no | The name of the node. Must be unique per job. Up to 255 characters. |
| `description` | `string \| null` | no | A description in markdown format. Up to 1024 characters. |
| `pictureURL` | `string (uri) \| null` | no | URL of a picture of the stop. |
| `pointId` | `string \| null` | no | A registered point of the job's location. The node takes its coordinates. An unknown point answers `POINT_NOT_FOUND`. |
| `lat` | `number \| null` | no | Latitude of the node. -90 to 90. |
| `lng` | `number \| null` | no | Longitude of the node. -180 to 180. |
| `azimuth` | `number \| null` | no | Azimuth of the node. |
| `expendable` | `boolean` | no | Whether the job is expendable in this node. |
| `allowFailure` | `boolean` | no | Whether failure of this node is allowed. |
| `travelDuration` | `number` | no | Estimated travel time to this node, in milliseconds. |
| `released` | `boolean` | no | If false, the node requires manual confirmation to move forward. |
| `metadata` | `Record<string, unknown> \| null` | no | A record of key-value pairs containing additional metadata about the entity. |
| `actions` | `NewAction[]` | no | Actions to run at the node, in order. |

### NewAction

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | `string` | yes | The name of the action. Must be unique per node. Up to 255 characters. |
| `type` | `string` | yes | What the action does. `load` and `unload` are handled by the engine (see the load and unload routes); other values are free-form. Up to 255 characters. |
| `duration` | `number` | no | Estimated time to complete the action, in milliseconds. |
| `packageName` | `string \| null` | no | The name of the package associated with the action. |
| `bundleName` | `string \| null` | no | The bundle name associated with the action. Up to 255 characters. |
| `blockingType` | `'soft' \| 'hard'` | no | `hard` (default) blocks the movement and the other actions. `soft` blocks only the movement. |
| `allowFailure` | `boolean` | no | If true, the job continues when this action fails. |
| `metadata` | `Record<string, unknown> \| null` | no | Metadata and params for the action. |

### NewPackage

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | `string` | yes | The name of the package. Must be unique per job. Up to 255 characters. |
| `bundleName` | `string \| null` | no | Group identifier for the package. Up to 255 characters. |
| `description` | `string \| null` | no | A description in markdown format. Up to 1024 characters. |
| `pictureURL` | `string (uri) \| null` | no | URL of a picture of the package. |
| `items` | `{ name: string, quantity: number } & Record<string, unknown>[] \| null` | no | What is inside. Each item needs `name` and `quantity` (at least 1); other fields are kept. |
| `metadata` | `Record<string, unknown> \| null` | no | A record of key-value pairs containing additional metadata about the entity. |
| `station` | `string \| null` | no | Prep station that owns this package (e.g. "Burger Shop"). Trimmed; blank becomes null. |

### NewHook

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | `string` | yes | The name of the hook. Must be unique per job. Up to 255 characters. |
| `eventType` | `enum[] \| null` | no | Fire only for these event types. Omit for all. |
| `nodeName` | `string[] \| null` | no | Filter events to specific nodes by their names. |
| `actionName` | `string[] \| null` | no | Filter events to specific actions by their names. |
| `packageName` | `string[] \| null` | no | Filter events to specific packages by their names. |
| `jobState` | `enum[] \| null` | no | Fire only while the job is in one of these states. Omit for all. |
| `action` | `'call_webhook'` | no | Only `call_webhook`. Inferred from an `https://` or `http://` `target` when omitted. |
| `target` | `string` | no | The URL to call. |
| `queueName` | `string \| null` | no | Serialization queue for this hook, scoped to the job. Hooks of the same job sharing a queue name execute one at a time in event order, and a failing hook retries to its limit before the next one runs. Omit for the default concurrent dispatch. Up to 255 characters. |
| `metadata` | `Record<string, unknown> \| null` | no | Extra settings for the action. For `call_webhook`: `{ "webhook": { "method": "POST", "headers": { "X-Key": "value" } } }`. `method` is POST, GET, PATCH or PUT; send both `method` and `headers`, or the defaults apply (POST, no extra headers). |
