{
    "openapi": "3.1.2",
    "info": {
        "title": "Tawasul API",
        "version": "1",
        "description": "Push vehicle telemetry from a tracking platform to Tawasul, and read your own company's fleet data with a company key. Every answer uses one JSON envelope; clients branch on error.code, never on the message."
    },
    "servers": [
        {
            "url": "https://tawasulone.com/api/v1"
        }
    ],
    "security": [
        {
            "sourceToken": []
        }
    ],
    "paths": {
        "/accidents": {
            "get": {
                "operationId": "accidents.index",
                "description": "Lists your company's recorded accidents, oldest first, one page at a time. Each carries the vehicle, when and where on the map, the kind of party, the source of the report, the share of fault in quarters and the state of the insurance claim. Each also says whether the driver sent it from the app and how many photos it holds. The other party, the driver, the notes, the report and claim numbers, the files themselves and every amount are never shown. Every request is recorded as a read of confidential records. A branch-limited key sees only the accidents of the vehicles that are currently in its branch.\n\nRequires the key scope `accidents:read`.",
                "summary": "List accidents",
                "tags": [
                    "Accident"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only accidents whose claim is in this state: none, under_review, accepted, accepted_partly, rejected or received.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "under_review"
                    },
                    {
                        "name": "vehicle",
                        "in": "query",
                        "description": "Only the accidents of this vehicle (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only accidents changed at or after this moment (ISO 8601 with an offset, e.g. 2026-05-01T00:00:00Z).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of accidents.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "5a3c9e12-8d47-4b60-a1f2-7e0b4d9c3a68",
                                                    "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                    "occurred_at": "2026-05-12T07:48:00Z",
                                                    "lat": 24.7136,
                                                    "lng": 46.6753,
                                                    "party_kind": "vehicle",
                                                    "report_source": "najm",
                                                    "liability_quarters": 2,
                                                    "claim_state": "under_review",
                                                    "from_driver_app": false,
                                                    "photo_count": 0,
                                                    "created_at": "2026-05-12T09:10:12Z",
                                                    "updated_at": "2026-05-12T09:10:12Z",
                                                    "row_version": 2
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "post": {
                "operationId": "accidents.record",
                "description": "Records an accident of one of your company's vehicles as the panel does, with its notice to the accident managers: the vehicle, when it happened (ISO 8601 with an offset, not in the future), optionally where on the map, the kind of other party (vehicle, property or none) and the share of fault in quarters. The other party's details, the driver, notes, report and claim numbers, the injury class and files are never accepted: they stay in the panel. A vehicle of another company or branch answers 404 exactly like one that does not exist. A daily cap applies per key and per company. Requires the key scope `fleet:accidents:write`, the company setting for accident writes and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:accidents:write`.",
                "summary": "Record an accident",
                "tags": [
                    "AccidentWrite"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/RecordAccidentRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "vehicle": {
                                                "type": "string",
                                                "format": "uuid",
                                                "description": "The vehicle, by its uuid.",
                                                "examples": [
                                                    "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11"
                                                ]
                                            },
                                            "occurred_at": {
                                                "type": "string",
                                                "format": "date-time",
                                                "description": "When it happened.",
                                                "examples": [
                                                    "2026-05-12T07:48:00+03:00"
                                                ]
                                            },
                                            "lat": {
                                                "type": "object",
                                                "description": "Latitude, with lng.",
                                                "examples": [
                                                    24.7136
                                                ]
                                            },
                                            "lng": {
                                                "type": "object",
                                                "description": "Longitude, with lat.",
                                                "examples": [
                                                    46.6753
                                                ]
                                            },
                                            "party_kind": {
                                                "type": "string",
                                                "description": "vehicle, property or none.",
                                                "examples": [
                                                    "vehicle"
                                                ]
                                            },
                                            "liability_quarters": {
                                                "type": "integer",
                                                "description": "The share of fault in quarters, 0 to 4.",
                                                "examples": [
                                                    2
                                                ]
                                            }
                                        },
                                        "required": [
                                            "vehicle",
                                            "occurred_at",
                                            "party_kind"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "201": {
                        "description": "The accident that was recorded.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "5a3c9e12-8d47-4b60-a1f2-7e0b4d9c3a68",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "occurred_at": "2026-05-12T07:48:00Z",
                                                "lat": 24.7136,
                                                "lng": 46.6753,
                                                "party_kind": "vehicle",
                                                "report_source": "najm",
                                                "liability_quarters": 2,
                                                "claim_state": "under_review",
                                                "from_driver_app": false,
                                                "photo_count": 0,
                                                "created_at": "2026-05-12T09:10:12Z",
                                                "updated_at": "2026-05-12T09:10:12Z",
                                                "row_version": 2
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/accidents/{uuid}": {
            "get": {
                "operationId": "accidents.show",
                "description": "Reads one of your company's accidents by its uuid. A record of another company or branch answers 404 exactly like one that does not exist. The request is recorded as a read of confidential records.\n\nRequires the key scope `accidents:read`.",
                "summary": "Read an accident",
                "tags": [
                    "Accident"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The accident.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "5a3c9e12-8d47-4b60-a1f2-7e0b4d9c3a68",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "occurred_at": "2026-05-12T07:48:00Z",
                                                "lat": 24.7136,
                                                "lng": 46.6753,
                                                "party_kind": "vehicle",
                                                "report_source": "najm",
                                                "liability_quarters": 2,
                                                "claim_state": "under_review",
                                                "from_driver_app": false,
                                                "photo_count": 0,
                                                "created_at": "2026-05-12T09:10:12Z",
                                                "updated_at": "2026-05-12T09:10:12Z",
                                                "row_version": 2
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "additionalProperties": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/accidents/{uuid}/claim": {
            "post": {
                "operationId": "accidents.claim",
                "description": "Sets the insurance claim state of one of your company's accidents and its amounts, as the panel does. Send the `row_version` you read; an accident changed meanwhile answers 409. Amounts are text decimals with the currency's places (Arabic digits are read as Latin ones); accepted is not above claimed and received is not above accepted. A received claim is final. A daily cap applies per key and per company. Requires the key scope `fleet:accidents:write`, the company setting for accident writes and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:accidents:write`.",
                "summary": "Update the claim of an accident",
                "tags": [
                    "AccidentWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/UpdateAccidentClaimRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The version of the accident you read.",
                                                "examples": [
                                                    1
                                                ]
                                            },
                                            "claim_state": {
                                                "type": "string",
                                                "description": "none, under_review, accepted, accepted_partly, rejected or received.",
                                                "examples": [
                                                    "under_review"
                                                ]
                                            },
                                            "currency": {
                                                "type": "string",
                                                "description": "The currency code; the company default when absent.",
                                                "examples": [
                                                    "SAR"
                                                ]
                                            },
                                            "claimed": {
                                                "type": "string",
                                                "description": "The claimed amount as a decimal text.",
                                                "examples": [
                                                    "9000.00"
                                                ]
                                            },
                                            "accepted": {
                                                "type": "string",
                                                "description": "The accepted amount as a decimal text.",
                                                "examples": [
                                                    "8000.00"
                                                ]
                                            },
                                            "received": {
                                                "type": "string",
                                                "description": "The received amount as a decimal text.",
                                                "examples": [
                                                    "8000.00"
                                                ]
                                            },
                                            "received_on": {
                                                "type": "string",
                                                "format": "date",
                                                "description": "The day it was received (YYYY-MM-DD).",
                                                "examples": [
                                                    "2026-06-01"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version",
                                            "claim_state"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The accident with its claim updated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "5a3c9e12-8d47-4b60-a1f2-7e0b4d9c3a68",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "occurred_at": "2026-05-12T07:48:00Z",
                                                "lat": 24.7136,
                                                "lng": 46.6753,
                                                "party_kind": "vehicle",
                                                "report_source": "najm",
                                                "liability_quarters": 2,
                                                "claim_state": "under_review",
                                                "from_driver_app": false,
                                                "photo_count": 0,
                                                "created_at": "2026-05-12T09:10:12Z",
                                                "updated_at": "2026-05-12T09:10:12Z",
                                                "row_version": 2
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/accidents/{uuid}/clips": {
            "post": {
                "operationId": "accidents.clips.attach",
                "description": "Attaches one camera clip to one of your company's accidents, as the panel does: the clip must be playable, taken by the accident's own vehicle within 6 hours of the accident, and at most 10 clips can be attached. Attaching puts the clip in front of everyone who may open the accident, so the key needs both the scopes `fleet:accidents:write` and `video:events:read`, and its owner must be allowed to view camera events. A clip that does not exist, belongs to another company or another vehicle, or that the key's owner may not view answers 404, all the same. The attachment is recorded and leaves one read of confidential records. A daily cap applies per key and per company. Requires the company setting for accident writes and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:accidents:write`.",
                "summary": "Attach a camera clip to an accident",
                "tags": [
                    "AccidentWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/AttachAccidentClipRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "clip": {
                                                "type": "string",
                                                "format": "uuid",
                                                "description": "The clip, by the uuid its event shows in `footage`.",
                                                "examples": [
                                                    "9d2b7c4e-1f63-4a08-8c5d-6e0a3b1f7d25"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "clip"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The accident the clip was attached to.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "5a3c9e12-8d47-4b60-a1f2-7e0b4d9c3a68",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "occurred_at": "2026-05-12T07:48:00Z",
                                                "lat": 24.7136,
                                                "lng": 46.6753,
                                                "party_kind": "vehicle",
                                                "report_source": "najm",
                                                "liability_quarters": 2,
                                                "claim_state": "under_review",
                                                "from_driver_app": false,
                                                "photo_count": 0,
                                                "created_at": "2026-05-12T09:10:12Z",
                                                "updated_at": "2026-05-12T09:10:12Z",
                                                "row_version": 2
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/accidents/{uuid}/clips/{clip}/detach": {
            "post": {
                "operationId": "accidents.clips.detach",
                "description": "Detaches one of the clips already attached to one of your company's accidents. It needs no camera right: removing a clip from view never depends on one. A clip that is not attached to this accident answers 404. The change is recorded. A daily cap applies per key and per company. Requires the key scope `fleet:accidents:write`, the company setting for accident writes and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:accidents:write`.",
                "summary": "Detach a camera clip from an accident",
                "tags": [
                    "AccidentWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "clip",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The accident the clip was detached from.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "5a3c9e12-8d47-4b60-a1f2-7e0b4d9c3a68",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "occurred_at": "2026-05-12T07:48:00Z",
                                                "lat": 24.7136,
                                                "lng": 46.6753,
                                                "party_kind": "vehicle",
                                                "report_source": "najm",
                                                "liability_quarters": 2,
                                                "claim_state": "under_review",
                                                "from_driver_app": false,
                                                "photo_count": 0,
                                                "created_at": "2026-05-12T09:10:12Z",
                                                "updated_at": "2026-05-12T09:10:12Z",
                                                "row_version": 2
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/alerts": {
            "get": {
                "operationId": "alerts.index",
                "description": "Lists your company's alerts (open, acknowledged and closed), oldest first, one page at a time; each carries its kind, severity, vehicle by uuid and times under an opaque ref. A branch-limited key sees only its own branch. Times are UTC; meta.timezone names the platform time zone. A closed alert says how it ended in close_cause: person (a person closed it), condition_cleared (the platform saw the condition normal again) or automatic (the platform closed it without seeing that, for instance when its rule was switched off or the vehicle went silent); it is null while the alert is open, and a client should treat any other value as automatic.\n\nRequires the key scope `alerts:read`.",
                "summary": "List alerts",
                "tags": [
                    "Alert"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only alerts in this state: open, acknowledged or closed.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "open"
                    },
                    {
                        "name": "type",
                        "in": "query",
                        "description": "Only alerts of this kind, e.g. OVERSPEED.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "vehicle",
                        "in": "query",
                        "description": "Only the alerts of this vehicle (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "branch",
                        "in": "query",
                        "description": "Only alerts of this branch (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only alerts changed at or after this moment (ISO 8601 with an offset, e.g. 2026-05-01T00:00:00Z).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of alerts.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "ref": "Zk3Q8vTn0aXy7mP2cLw9dA",
                                                    "type": "OVERSPEED",
                                                    "severity": "warning",
                                                    "status": "open",
                                                    "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                    "occurred_at": "2026-06-01T08:59:10.250Z",
                                                    "acknowledged_at": null,
                                                    "closed_at": null,
                                                    "close_cause": null,
                                                    "updated_at": "2026-06-01T08:59:11Z",
                                                    "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable: the platform has no public-id key configured; the alerts calls refuse until its operator sets it.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string",
                                    "examples": [
                                        {
                                            "success": false,
                                            "data": null,
                                            "error": {
                                                "code": "service_unavailable",
                                                "message": "The service is temporarily unavailable. Retry later."
                                            },
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/alerts/{ref}": {
            "get": {
                "operationId": "alerts.show",
                "description": "Reads one of your company's alerts by its ref. An alert of another company or branch, an unknown ref and one that is not yet an alert all answer 404. A closed alert says how it ended in close_cause: person (a person closed it), condition_cleared (the platform saw the condition normal again) or automatic (the platform closed it without seeing that, for instance when its rule was switched off or the vehicle went silent); it is null while the alert is open, and a client should treat any other value as automatic.\n\nRequires the key scope `alerts:read`.",
                "summary": "Read an alert",
                "tags": [
                    "Alert"
                ],
                "parameters": [
                    {
                        "name": "ref",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The alert.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "ref": "Zk3Q8vTn0aXy7mP2cLw9dA",
                                                "type": "OVERSPEED",
                                                "severity": "warning",
                                                "status": "open",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "occurred_at": "2026-06-01T08:59:10.250Z",
                                                "acknowledged_at": null,
                                                "closed_at": null,
                                                "close_cause": null,
                                                "updated_at": "2026-06-01T08:59:11Z",
                                                "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable: the platform has no public-id key configured; the alerts calls refuse until its operator sets it.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string",
                                    "examples": [
                                        {
                                            "success": false,
                                            "data": null,
                                            "error": {
                                                "code": "service_unavailable",
                                                "message": "The service is temporarily unavailable. Retry later."
                                            },
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/fleet-assets/{uuid}/assignments": {
            "post": {
                "operationId": "fleet_assets.assignments.store",
                "description": "Couples one of your trailers to a vehicle, or assigns a piece of equipment to a vehicle or a driver, as the panel does. Send exactly one of `vehicle_uuid` and `driver_uuid`; a trailer takes a vehicle only, an asset that already has a holder answers 422 until the current one is ended, and an unknown or foreign asset, vehicle or driver answers 404. The panel's warning when a head may not pull a trailer is not given here. Requires the key owner's right to update assets and the company's assets API setting.\n\nRequires the key scope `fleet:asset_assignments:write`.",
                "summary": "Couple a trailer or assign equipment",
                "tags": [
                    "AssetAssignmentWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/AssignAssetRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "vehicle_uuid": {
                                                "type": "string",
                                                "description": "The vehicle that holds the asset.",
                                                "examples": [
                                                    "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11"
                                                ]
                                            },
                                            "driver_uuid": {
                                                "type": "string",
                                                "description": "The driver that holds the equipment."
                                            }
                                        }
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The new holding.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "6f2c1d9e-4b7a-4e21-9c3d-8a5b0e7f1c22",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "driver_uuid": null,
                                                "started_at": "2026-11-20T05:00:00Z",
                                                "ended_at": null,
                                                "current": true
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-20T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uuid": {
                                                    "type": "string"
                                                },
                                                "vehicle_uuid": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "driver_uuid": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "started_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "ended_at": {
                                                    "type": "null"
                                                },
                                                "current": {
                                                    "type": "boolean"
                                                }
                                            },
                                            "required": [
                                                "uuid",
                                                "vehicle_uuid",
                                                "driver_uuid",
                                                "started_at",
                                                "ended_at",
                                                "current"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "get": {
                "operationId": "fleet_assets.assignments",
                "description": "The vehicles and drivers one of your trailers or pieces of equipment was assigned to, newest first, at most 100. A vehicle or driver you may not see, or whose register your own rights do not open, is shown as null. An asset of another company or branch answers 404.\n\nRequires the key scope `fleet_assets:read`.",
                "summary": "Read a fleet asset's assignments",
                "tags": [
                    "FleetAssetAssignment"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The assignments.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "asset_uuid": "9e2b7c14-3d58-4f0a-b6a1-7c4d2e8f5a10",
                                                "assignments": [
                                                    {
                                                        "uuid": "6f2c1d9e-4b7a-4e21-9c3d-8a5b0e7f1c22",
                                                        "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                        "driver_uuid": null,
                                                        "started_at": "2026-10-01T05:00:00Z",
                                                        "ended_at": null,
                                                        "current": true
                                                    }
                                                ]
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-15T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "asset_uuid": {
                                                            "type": "string"
                                                        },
                                                        "assignments": {
                                                            "type": "array",
                                                            "items": {
                                                                "type": "string"
                                                            }
                                                        }
                                                    },
                                                    "required": [
                                                        "asset_uuid",
                                                        "assignments"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "type": "string"
                                                        },
                                                        "timestamp": {
                                                            "type": "string"
                                                        },
                                                        "timezone": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "timezone"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/fleet-assets/{uuid}/assignments/end": {
            "post": {
                "operationId": "fleet_assets.assignments.end",
                "description": "Ends the current coupling or assignment of one of your assets with a reason, as the panel does; the holding stays in the history. Send the `assignment_uuid` you mean to end: when another holding is current now it answers 409 and ends nothing. Answers 422 when the asset has no current holder. Requires the key owner's right to update assets and the company's assets API setting.\n\nRequires the key scope `fleet:asset_assignments:write`.",
                "summary": "End the current coupling or assignment",
                "tags": [
                    "AssetAssignmentWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/EndAssetAssignmentRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "assignment_uuid": {
                                                "type": "string",
                                                "description": "The holding you mean to end, as the create call or the assignments read gave it; another current holding answers 409.",
                                                "examples": [
                                                    "6f2c1d9e-4b7a-4e21-9c3d-8a5b0e7f1c22"
                                                ]
                                            },
                                            "reason": {
                                                "type": "string",
                                                "description": "Why it ends, with no card or identity number.",
                                                "examples": [
                                                    "Trailer moved to another head"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "assignment_uuid",
                                            "reason"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The ended holding.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "6f2c1d9e-4b7a-4e21-9c3d-8a5b0e7f1c22",
                                                "started_at": "2026-11-20T05:00:00Z",
                                                "ended_at": "2026-11-21T05:00:00Z",
                                                "current": false
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-21T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "started_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "ended_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "current": {
                                                            "type": "boolean"
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "started_at",
                                                        "ended_at",
                                                        "current"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/fleet-assets/{uuid}/files": {
            "post": {
                "operationId": "fleet_assets.files.store",
                "description": "Attaches a PDF, JPEG or PNG to one of your trailers or pieces of equipment, with its kind and an optional end day, as the panel does. The file name you send is not kept. A JPEG that carries a GPS position is refused. An asset of another company or branch answers 404.\n\nRequires the key scope `fleet:asset_files:write`.",
                "summary": "Attach a file to a fleet asset",
                "tags": [
                    "AssetFileWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/UploadAssetFileRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "file": {
                                                "type": "string",
                                                "format": "binary",
                                                "description": "The file, sent as multipart form data."
                                            },
                                            "kind": {
                                                "type": "string",
                                                "description": "registration, insurance, manual, photo or other.",
                                                "examples": [
                                                    "insurance"
                                                ]
                                            },
                                            "expires_on": {
                                                "type": "string",
                                                "description": "The day the file ends, YYYY-MM-DD.",
                                                "examples": [
                                                    "2027-11-01"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "file",
                                            "kind"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The attached file.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "5d1c8a47-2e93-4b6f-9a10-3c7e5f9b2d64",
                                                "kind": "insurance",
                                                "attached_on": "2026-11-01",
                                                "expires_on": "2027-11-01"
                                            },
                                            "error": null,
                                            "meta": []
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uuid": {
                                                    "type": "string"
                                                },
                                                "kind": {
                                                    "type": "string"
                                                },
                                                "attached_on": {
                                                    "type": "string"
                                                },
                                                "expires_on": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "uuid",
                                                "kind",
                                                "attached_on",
                                                "expires_on"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "get": {
                "operationId": "fleet_assets.files.index",
                "description": "The files of one of your trailers or pieces of equipment that were not removed, the newest first: kind and the day they were attached. An asset of another company or branch answers 404.\n\nRequires the key scope `fleet_assets:read`.",
                "summary": "List a fleet asset's files",
                "tags": [
                    "FleetAssetFile"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The files.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "asset_uuid": "9e2b7c14-3d58-4f0a-b6a1-7c4d2e8f5a10",
                                                "files": [
                                                    {
                                                        "uuid": "5d1c8a47-2e93-4b6f-9a10-3c7e5f9b2d64",
                                                        "kind": "insurance",
                                                        "attached_on": "2026-11-01",
                                                        "expires_on": "2027-11-01"
                                                    }
                                                ]
                                            },
                                            "error": null,
                                            "meta": []
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "asset_uuid": {
                                                            "type": "string"
                                                        },
                                                        "files": {
                                                            "type": "array",
                                                            "items": {
                                                                "type": "string"
                                                            }
                                                        }
                                                    },
                                                    "required": [
                                                        "asset_uuid",
                                                        "files"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "type": "string"
                                                        },
                                                        "timestamp": {
                                                            "type": "string"
                                                        },
                                                        "timezone": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "timezone"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/fleet-assets/{uuid}/files/{fileUuid}/void": {
            "post": {
                "operationId": "fleet_assets.files.void",
                "description": "Removes one file from the asset's list with a reason; the file stays in the record and is never deleted. A file of another company, branch or asset answers 404.\n\nRequires the key scope `fleet:asset_files:write`.",
                "summary": "Remove a fleet asset file",
                "tags": [
                    "AssetFileWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "fileUuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/VoidAssetFileRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "reason": {
                                                "type": "string",
                                                "description": "Why the file is removed, 10 to 500 characters, with no card or identity number.",
                                                "examples": [
                                                    "Replaced by the renewed insurance"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "reason"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The removed file.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "5d1c8a47-2e93-4b6f-9a10-3c7e5f9b2d64",
                                                "kind": "insurance",
                                                "attached_on": "2026-11-01",
                                                "expires_on": "2027-11-01"
                                            },
                                            "error": null,
                                            "meta": []
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "kind": {
                                                            "type": "string"
                                                        },
                                                        "attached_on": {
                                                            "type": "string"
                                                        },
                                                        "expires_on": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "kind",
                                                        "attached_on",
                                                        "expires_on"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/fleet-assets": {
            "post": {
                "operationId": "fleet_assets.store",
                "description": "Creates a trailer or a piece of equipment of your company, as the panel does. Catalogue values (category, make, model) are sent by code; an unknown code answers 422. Only an owned or co-owned asset is accepted: a lessor is never taken through a key. Requires the key scope `fleet:assets:write`, the company's assets API setting, an owner who manages assets, and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:assets:write`.",
                "summary": "Create a trailer or equipment",
                "tags": [
                    "AssetWrite"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/CreateAssetRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "kind": {
                                                "type": "string",
                                                "description": "trailer or equipment.",
                                                "examples": [
                                                    "trailer"
                                                ]
                                            },
                                            "category_code": {
                                                "type": "string",
                                                "description": "The asset category code, from GET /fleet-asset-categories.",
                                                "examples": [
                                                    "flatbed_trailer"
                                                ]
                                            },
                                            "asset_tag": {
                                                "type": "string",
                                                "description": "Your own tag for the asset, unique in the company.",
                                                "examples": [
                                                    "TR-014"
                                                ]
                                            },
                                            "name": {
                                                "type": "string",
                                                "description": "The name shown in the lists.",
                                                "examples": [
                                                    "Flatbed trailer 14"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "kind",
                                            "category_code",
                                            "asset_tag",
                                            "name"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The asset that was created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "9e2b7c14-3d58-4f0a-b6a1-7c4d2e8f5a10",
                                                "status": "active",
                                                "asset_tag": "TR-014",
                                                "name": "Flatbed trailer 14",
                                                "kind": "trailer",
                                                "category": "flatbed_trailer",
                                                "make": "Schmitz Cargobull",
                                                "make_code": "schmitz_cargobull",
                                                "model": "S01",
                                                "model_code": "s01",
                                                "version": "Mk2",
                                                "version_code": "mk2",
                                                "manufacture_year": 2021,
                                                "serial_number": "SN-0914",
                                                "chassis_number": "WSM00000000000014",
                                                "plate_number": "1234 ABC",
                                                "ownership_type": "owned",
                                                "capacity_value": "28.000",
                                                "capacity_unit": "ton",
                                                "coupling_type": "kingpin",
                                                "gross_weight_kg": 39000,
                                                "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                "archived_at": null,
                                                "created_at": "2026-03-01T08:30:00Z",
                                                "updated_at": "2026-05-12T11:05:42Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-17T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uuid": {
                                                    "type": "string"
                                                },
                                                "status": {
                                                    "type": "string"
                                                },
                                                "asset_tag": {
                                                    "type": "string"
                                                },
                                                "name": {
                                                    "type": "string"
                                                },
                                                "kind": {
                                                    "type": "string"
                                                },
                                                "category": {
                                                    "type": "string"
                                                },
                                                "make": {
                                                    "type": "string"
                                                },
                                                "make_code": {
                                                    "type": "string"
                                                },
                                                "model": {
                                                    "type": "string"
                                                },
                                                "model_code": {
                                                    "type": "string"
                                                },
                                                "version": {
                                                    "type": "string"
                                                },
                                                "version_code": {
                                                    "type": "string"
                                                },
                                                "manufacture_year": {
                                                    "type": "string"
                                                },
                                                "serial_number": {
                                                    "type": "string"
                                                },
                                                "chassis_number": {
                                                    "type": "string"
                                                },
                                                "plate_number": {
                                                    "type": "string"
                                                },
                                                "ownership_type": {
                                                    "type": "string"
                                                },
                                                "capacity_value": {
                                                    "type": "string"
                                                },
                                                "capacity_unit": {
                                                    "type": "string"
                                                },
                                                "coupling_type": {
                                                    "type": "string"
                                                },
                                                "gross_weight_kg": {
                                                    "type": "string"
                                                },
                                                "branch_uuid": {
                                                    "type": "string"
                                                },
                                                "archived_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "uuid",
                                                "status",
                                                "asset_tag",
                                                "name",
                                                "kind",
                                                "category",
                                                "make",
                                                "make_code",
                                                "model",
                                                "model_code",
                                                "version",
                                                "version_code",
                                                "manufacture_year",
                                                "serial_number",
                                                "chassis_number",
                                                "plate_number",
                                                "ownership_type",
                                                "capacity_value",
                                                "capacity_unit",
                                                "coupling_type",
                                                "gross_weight_kg",
                                                "branch_uuid",
                                                "archived_at",
                                                "created_at",
                                                "updated_at"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "get": {
                "operationId": "fleet_assets.index",
                "description": "Lists your company's trailers and equipment, oldest first, one page at a time. Archived assets are left out unless you ask for status=archived. A branch-limited key sees only its own branch. The lessor and the notes are never returned.\n\nRequires the key scope `fleet_assets:read`.",
                "summary": "List fleet assets",
                "tags": [
                    "FleetAsset"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only assets in this state.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "active"
                    },
                    {
                        "name": "branch",
                        "in": "query",
                        "description": "Only assets of this branch (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only assets changed at or after this moment (ISO 8601 with an offset, e.g. 2026-05-01T00:00:00Z).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of fleet assets.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "9e2b7c14-3d58-4f0a-b6a1-7c4d2e8f5a10",
                                                    "status": "active",
                                                    "asset_tag": "TR-014",
                                                    "name": "Flatbed trailer 14",
                                                    "kind": "trailer",
                                                    "category": "flatbed_trailer",
                                                    "make": "Schmitz Cargobull",
                                                    "make_code": "schmitz_cargobull",
                                                    "model": "S01",
                                                    "model_code": "s01",
                                                    "version": "Mk2",
                                                    "version_code": "mk2",
                                                    "manufacture_year": 2021,
                                                    "serial_number": "SN-0914",
                                                    "chassis_number": "WSM00000000000014",
                                                    "plate_number": "1234 ABC",
                                                    "ownership_type": "owned",
                                                    "capacity_value": "28.000",
                                                    "capacity_unit": "ton",
                                                    "coupling_type": "kingpin",
                                                    "gross_weight_kg": 39000,
                                                    "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                    "archived_at": null,
                                                    "created_at": "2026-03-01T08:30:00Z",
                                                    "updated_at": "2026-05-12T11:05:42Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/fleet-assets/{uuid}": {
            "patch": {
                "operationId": "fleet_assets.update",
                "description": "Changes the fields you send; the others stay. Send the `row_version` you read: a stale one answers 409. The kind never changes. Requires the key scope `fleet:assets:write` and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:assets:write`.",
                "summary": "Edit a trailer or equipment",
                "tags": [
                    "AssetWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/UpdateAssetRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The row version of the asset you read.",
                                                "examples": [
                                                    3
                                                ]
                                            },
                                            "name": {
                                                "type": "string",
                                                "description": "The new name.",
                                                "examples": [
                                                    "Flatbed trailer 14B"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The asset after the change.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "9e2b7c14-3d58-4f0a-b6a1-7c4d2e8f5a10",
                                                "status": "active",
                                                "asset_tag": "TR-014",
                                                "name": "Flatbed trailer 14",
                                                "kind": "trailer",
                                                "category": "flatbed_trailer",
                                                "make": "Schmitz Cargobull",
                                                "make_code": "schmitz_cargobull",
                                                "model": "S01",
                                                "model_code": "s01",
                                                "version": "Mk2",
                                                "version_code": "mk2",
                                                "manufacture_year": 2021,
                                                "serial_number": "SN-0914",
                                                "chassis_number": "WSM00000000000014",
                                                "plate_number": "1234 ABC",
                                                "ownership_type": "owned",
                                                "capacity_value": "28.000",
                                                "capacity_unit": "ton",
                                                "coupling_type": "kingpin",
                                                "gross_weight_kg": 39000,
                                                "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                "archived_at": null,
                                                "created_at": "2026-03-01T08:30:00Z",
                                                "updated_at": "2026-05-12T11:05:42Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-17T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "asset_tag": {
                                                            "type": "string"
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        },
                                                        "kind": {
                                                            "type": "string"
                                                        },
                                                        "category": {
                                                            "type": "string"
                                                        },
                                                        "make": {
                                                            "type": "string"
                                                        },
                                                        "make_code": {
                                                            "type": "string"
                                                        },
                                                        "model": {
                                                            "type": "string"
                                                        },
                                                        "model_code": {
                                                            "type": "string"
                                                        },
                                                        "version": {
                                                            "type": "string"
                                                        },
                                                        "version_code": {
                                                            "type": "string"
                                                        },
                                                        "manufacture_year": {
                                                            "type": "string"
                                                        },
                                                        "serial_number": {
                                                            "type": "string"
                                                        },
                                                        "chassis_number": {
                                                            "type": "string"
                                                        },
                                                        "plate_number": {
                                                            "type": "string"
                                                        },
                                                        "ownership_type": {
                                                            "type": "string"
                                                        },
                                                        "capacity_value": {
                                                            "type": "string"
                                                        },
                                                        "capacity_unit": {
                                                            "type": "string"
                                                        },
                                                        "coupling_type": {
                                                            "type": "string"
                                                        },
                                                        "gross_weight_kg": {
                                                            "type": "string"
                                                        },
                                                        "branch_uuid": {
                                                            "type": "string"
                                                        },
                                                        "archived_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "status",
                                                        "asset_tag",
                                                        "name",
                                                        "kind",
                                                        "category",
                                                        "make",
                                                        "make_code",
                                                        "model",
                                                        "model_code",
                                                        "version",
                                                        "version_code",
                                                        "manufacture_year",
                                                        "serial_number",
                                                        "chassis_number",
                                                        "plate_number",
                                                        "ownership_type",
                                                        "capacity_value",
                                                        "capacity_unit",
                                                        "coupling_type",
                                                        "gross_weight_kg",
                                                        "branch_uuid",
                                                        "archived_at",
                                                        "created_at",
                                                        "updated_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "get": {
                "operationId": "fleet_assets.show",
                "description": "Reads one of your company's trailers or pieces of equipment by its uuid. An asset of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `fleet_assets:read`.",
                "summary": "Read a fleet asset",
                "tags": [
                    "FleetAsset"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The fleet asset.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "9e2b7c14-3d58-4f0a-b6a1-7c4d2e8f5a10",
                                                "status": "active",
                                                "asset_tag": "TR-014",
                                                "name": "Flatbed trailer 14",
                                                "kind": "trailer",
                                                "category": "flatbed_trailer",
                                                "make": "Schmitz Cargobull",
                                                "make_code": "schmitz_cargobull",
                                                "model": "S01",
                                                "model_code": "s01",
                                                "version": "Mk2",
                                                "version_code": "mk2",
                                                "manufacture_year": 2021,
                                                "serial_number": "SN-0914",
                                                "chassis_number": "WSM00000000000014",
                                                "plate_number": "1234 ABC",
                                                "ownership_type": "owned",
                                                "capacity_value": "28.000",
                                                "capacity_unit": "ton",
                                                "coupling_type": "kingpin",
                                                "gross_weight_kg": 39000,
                                                "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                "archived_at": null,
                                                "created_at": "2026-03-01T08:30:00Z",
                                                "updated_at": "2026-05-12T11:05:42Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "additionalProperties": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/fleet-assets/{uuid}/archive": {
            "post": {
                "operationId": "fleet_assets.archive",
                "description": "Archives an asset with a reason: it leaves the active lists and keeps its record. A coupled trailer must be uncoupled first. Send the `row_version` you read: a stale one answers 409.\n\nRequires the key scope `fleet:assets:write`.",
                "summary": "Archive a trailer or equipment",
                "tags": [
                    "AssetWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/ArchiveAssetRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The row version of the asset you read.",
                                                "examples": [
                                                    3
                                                ]
                                            },
                                            "reason": {
                                                "type": "string",
                                                "description": "Why the asset is archived, with no card or identity number.",
                                                "examples": [
                                                    "Sold to another company"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version",
                                            "reason"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The archived asset.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "9e2b7c14-3d58-4f0a-b6a1-7c4d2e8f5a10",
                                                "status": "active",
                                                "asset_tag": "TR-014",
                                                "name": "Flatbed trailer 14",
                                                "kind": "trailer",
                                                "category": "flatbed_trailer",
                                                "make": "Schmitz Cargobull",
                                                "make_code": "schmitz_cargobull",
                                                "model": "S01",
                                                "model_code": "s01",
                                                "version": "Mk2",
                                                "version_code": "mk2",
                                                "manufacture_year": 2021,
                                                "serial_number": "SN-0914",
                                                "chassis_number": "WSM00000000000014",
                                                "plate_number": "1234 ABC",
                                                "ownership_type": "owned",
                                                "capacity_value": "28.000",
                                                "capacity_unit": "ton",
                                                "coupling_type": "kingpin",
                                                "gross_weight_kg": 39000,
                                                "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                "archived_at": null,
                                                "created_at": "2026-03-01T08:30:00Z",
                                                "updated_at": "2026-05-12T11:05:42Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-17T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "asset_tag": {
                                                            "type": "string"
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        },
                                                        "kind": {
                                                            "type": "string"
                                                        },
                                                        "category": {
                                                            "type": "string"
                                                        },
                                                        "make": {
                                                            "type": "string"
                                                        },
                                                        "make_code": {
                                                            "type": "string"
                                                        },
                                                        "model": {
                                                            "type": "string"
                                                        },
                                                        "model_code": {
                                                            "type": "string"
                                                        },
                                                        "version": {
                                                            "type": "string"
                                                        },
                                                        "version_code": {
                                                            "type": "string"
                                                        },
                                                        "manufacture_year": {
                                                            "type": "string"
                                                        },
                                                        "serial_number": {
                                                            "type": "string"
                                                        },
                                                        "chassis_number": {
                                                            "type": "string"
                                                        },
                                                        "plate_number": {
                                                            "type": "string"
                                                        },
                                                        "ownership_type": {
                                                            "type": "string"
                                                        },
                                                        "capacity_value": {
                                                            "type": "string"
                                                        },
                                                        "capacity_unit": {
                                                            "type": "string"
                                                        },
                                                        "coupling_type": {
                                                            "type": "string"
                                                        },
                                                        "gross_weight_kg": {
                                                            "type": "string"
                                                        },
                                                        "branch_uuid": {
                                                            "type": "string"
                                                        },
                                                        "archived_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "status",
                                                        "asset_tag",
                                                        "name",
                                                        "kind",
                                                        "category",
                                                        "make",
                                                        "make_code",
                                                        "model",
                                                        "model_code",
                                                        "version",
                                                        "version_code",
                                                        "manufacture_year",
                                                        "serial_number",
                                                        "chassis_number",
                                                        "plate_number",
                                                        "ownership_type",
                                                        "capacity_value",
                                                        "capacity_unit",
                                                        "coupling_type",
                                                        "gross_weight_kg",
                                                        "branch_uuid",
                                                        "archived_at",
                                                        "created_at",
                                                        "updated_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/fleet-assets/{uuid}/restore": {
            "post": {
                "operationId": "fleet_assets.restore",
                "description": "Brings an archived asset back to the active lists. Send the `row_version` you read: a stale one answers 409; a tag already used by another asset answers 422.\n\nRequires the key scope `fleet:assets:write`.",
                "summary": "Restore a trailer or equipment",
                "tags": [
                    "AssetWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/RestoreAssetRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The row version of the asset you read.",
                                                "examples": [
                                                    4
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The restored asset.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "9e2b7c14-3d58-4f0a-b6a1-7c4d2e8f5a10",
                                                "status": "active",
                                                "asset_tag": "TR-014",
                                                "name": "Flatbed trailer 14",
                                                "kind": "trailer",
                                                "category": "flatbed_trailer",
                                                "make": "Schmitz Cargobull",
                                                "make_code": "schmitz_cargobull",
                                                "model": "S01",
                                                "model_code": "s01",
                                                "version": "Mk2",
                                                "version_code": "mk2",
                                                "manufacture_year": 2021,
                                                "serial_number": "SN-0914",
                                                "chassis_number": "WSM00000000000014",
                                                "plate_number": "1234 ABC",
                                                "ownership_type": "owned",
                                                "capacity_value": "28.000",
                                                "capacity_unit": "ton",
                                                "coupling_type": "kingpin",
                                                "gross_weight_kg": 39000,
                                                "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                "archived_at": null,
                                                "created_at": "2026-03-01T08:30:00Z",
                                                "updated_at": "2026-05-12T11:05:42Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-17T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "asset_tag": {
                                                            "type": "string"
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        },
                                                        "kind": {
                                                            "type": "string"
                                                        },
                                                        "category": {
                                                            "type": "string"
                                                        },
                                                        "make": {
                                                            "type": "string"
                                                        },
                                                        "make_code": {
                                                            "type": "string"
                                                        },
                                                        "model": {
                                                            "type": "string"
                                                        },
                                                        "model_code": {
                                                            "type": "string"
                                                        },
                                                        "version": {
                                                            "type": "string"
                                                        },
                                                        "version_code": {
                                                            "type": "string"
                                                        },
                                                        "manufacture_year": {
                                                            "type": "string"
                                                        },
                                                        "serial_number": {
                                                            "type": "string"
                                                        },
                                                        "chassis_number": {
                                                            "type": "string"
                                                        },
                                                        "plate_number": {
                                                            "type": "string"
                                                        },
                                                        "ownership_type": {
                                                            "type": "string"
                                                        },
                                                        "capacity_value": {
                                                            "type": "string"
                                                        },
                                                        "capacity_unit": {
                                                            "type": "string"
                                                        },
                                                        "coupling_type": {
                                                            "type": "string"
                                                        },
                                                        "gross_weight_kg": {
                                                            "type": "string"
                                                        },
                                                        "branch_uuid": {
                                                            "type": "string"
                                                        },
                                                        "archived_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "status",
                                                        "asset_tag",
                                                        "name",
                                                        "kind",
                                                        "category",
                                                        "make",
                                                        "make_code",
                                                        "model",
                                                        "model_code",
                                                        "version",
                                                        "version_code",
                                                        "manufacture_year",
                                                        "serial_number",
                                                        "chassis_number",
                                                        "plate_number",
                                                        "ownership_type",
                                                        "capacity_value",
                                                        "capacity_unit",
                                                        "coupling_type",
                                                        "gross_weight_kg",
                                                        "branch_uuid",
                                                        "archived_at",
                                                        "created_at",
                                                        "updated_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/assignments": {
            "get": {
                "operationId": "assignments.index",
                "description": "Lists which driver drives which vehicle, newest first, one page at a time (at most 100). A row names the vehicle and the driver by uuid, the role, when it began and ended, and its origin and end reason as fixed words; never a name, a note or who made it. A driver or vehicle outside the key owner's branch or rights is left out. Requires the key scope `fleet:assignments:read`.\n\nRequires the key scope `fleet:assignments:read`.",
                "summary": "List driver assignments",
                "tags": [
                    "Assignment"
                ],
                "parameters": [
                    {
                        "name": "vehicle",
                        "in": "query",
                        "description": "Only this vehicle (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "driver",
                        "in": "query",
                        "description": "Only this driver (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "current",
                        "in": "query",
                        "description": "true for the assignments still running, false for the ended ones.",
                        "schema": {
                            "type": "boolean"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of assignments.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                    "driver_uuid": "3c1e9a52-8d47-4b6a-a2f0-5e7d9b4c1a44",
                                                    "role": "main",
                                                    "started_at": "2026-03-01T08:30:00Z",
                                                    "ended_at": null,
                                                    "end_reason": null,
                                                    "origin": "manual",
                                                    "current": true
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": []
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "page": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "limit": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": "integer"
                                                                                },
                                                                                []
                                                                            ]
                                                                        },
                                                                        "next_cursor": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": [
                                                                                        "string",
                                                                                        "null"
                                                                                    ]
                                                                                },
                                                                                []
                                                                            ]
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "limit",
                                                                        "next_cursor"
                                                                    ],
                                                                    "additionalProperties": []
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timezone": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "page",
                                                        "timezone"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/billing/invoices": {
            "get": {
                "operationId": "billing.invoices.index",
                "description": "Lists your company's invoices, oldest first, one page at a time; draft invoices are never shown. Money is whole minor units (halalas) next to the currency. A day's rows are capped per key and per company (429, reason `daily_rows`), and a key may make 60 calls a minute (429, reason `calls_per_minute`). Requires the key scope `billing:read` and an owner who may view or pay invoices; the module is closed (404) until the platform opens it.\n\nRequires the key scope `billing:read`.",
                "summary": "List invoices",
                "tags": [
                    "BillingInvoice"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only invoices in this state: issued, partially_paid, paid, credited, written_off or void.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "issued"
                    },
                    {
                        "name": "issued_from",
                        "in": "query",
                        "description": "Only invoices issued on or after this date (YYYY-MM-DD); send it with `issued_to`, at most 366 days apart.",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "issued_to",
                        "in": "query",
                        "description": "Only invoices issued on or before this date (YYYY-MM-DD).",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "One page of invoices; next_cursor is null on the last page.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "9b1e7c3a-4d52-4f08-8a6b-2c5d7e9f1a30",
                                                    "number": "INV-2026-000412",
                                                    "series": "tax",
                                                    "status": "issued",
                                                    "currency": "SAR",
                                                    "subtotal_minor": 10000,
                                                    "tax_minor": 1500,
                                                    "total_minor": 11500,
                                                    "balance_minor": 11500,
                                                    "credited_minor": 0,
                                                    "issue_date": "2026-10-01",
                                                    "due_date": "2026-10-31",
                                                    "created_at": "2026-10-01T08:00:00Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 25,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/billing/invoices/{uuid}": {
            "get": {
                "operationId": "billing.invoices.show",
                "description": "Reads one of your company's invoices by its uuid with its lines, at most 200 (`lines_truncated` says when more exist). An invoice of another company, and a draft, answers 404 exactly like one that does not exist; the read counts one row of the day's budget.\n\nRequires the key scope `billing:read`.",
                "summary": "Read an invoice",
                "tags": [
                    "BillingInvoice"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The invoice with its lines.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "9b1e7c3a-4d52-4f08-8a6b-2c5d7e9f1a30",
                                                "number": "INV-2026-000412",
                                                "series": "tax",
                                                "status": "issued",
                                                "currency": "SAR",
                                                "subtotal_minor": 10000,
                                                "tax_minor": 1500,
                                                "total_minor": 11500,
                                                "balance_minor": 11500,
                                                "credited_minor": 0,
                                                "issue_date": "2026-10-01",
                                                "due_date": "2026-10-31",
                                                "created_at": "2026-10-01T08:00:00Z",
                                                "lines": [
                                                    {
                                                        "description": "اشتراك المركبات - أكتوبر 2026",
                                                        "quantity_thousandths": 10000,
                                                        "unit_price_minor": 1000,
                                                        "tax_category": "standard",
                                                        "tax_rate_basis_points": 1500,
                                                        "tax_minor": 1500,
                                                        "subtotal_minor": 10000,
                                                        "total_minor": 11500
                                                    }
                                                ],
                                                "lines_truncated": false
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/billing/mandates": {
            "get": {
                "operationId": "billing.mandates.index",
                "description": "Lists your company's saved cards in the truncated form the panel shows: brand, last four digits, expiry and state. Never a holder name, a token or a gateway reference. Requires the key scope `billing:read` and an owner who may pay invoices (the view right alone is refused); the module is closed (404) until the platform opens it.\n\nRequires the key scope `billing:read`.",
                "summary": "List saved cards",
                "tags": [
                    "BillingMandate"
                ],
                "parameters": [
                    {
                        "name": "state",
                        "in": "query",
                        "description": "Only cards in this state: active, revoked or failing.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "active"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "One page of saved cards; next_cursor is null on the last page.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "2d8f4a6c-3b19-4e70-8c5a-9e1b3d7f0a42",
                                                    "card_brand": "visa",
                                                    "card_last4": "4242",
                                                    "card_exp_month": 12,
                                                    "card_exp_year": 2028,
                                                    "state": "active",
                                                    "created_at": "2026-09-01T10:00:00Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 25,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/billing/payments": {
            "get": {
                "operationId": "billing.payments.index",
                "description": "Lists the payments against your company's invoices, oldest first, one page at a time. A pending offline transfer does not reduce an invoice's balance until it is confirmed. The bank or gateway reference is never shown. Requires the key scope `billing:read` and an owner who may view or pay invoices; the module is closed (404) until the platform opens it.\n\nRequires the key scope `billing:read`.",
                "summary": "List payments",
                "tags": [
                    "BillingPayment"
                ],
                "parameters": [
                    {
                        "name": "state",
                        "in": "query",
                        "description": "Only payments in this state: pending_review, confirmed or rejected.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "confirmed"
                    },
                    {
                        "name": "invoice_uuid",
                        "in": "query",
                        "description": "Only the payments of this invoice.",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "received_from",
                        "in": "query",
                        "description": "Only payments received on or after this date (YYYY-MM-DD); send it with `received_to`, at most 366 days apart.",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "received_to",
                        "in": "query",
                        "description": "Only payments received on or before this date (YYYY-MM-DD).",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "One page of payments; next_cursor is null on the last page.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "4e6a2b8c-1d37-4c95-9f0e-7a3b5c8d2e61",
                                                    "method": "bank_transfer",
                                                    "state": "confirmed",
                                                    "amount_minor": 11500,
                                                    "currency": "SAR",
                                                    "received_on": "2026-10-05",
                                                    "created_at": "2026-10-05T09:30:00Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 25,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/reports/branch-profit": {
            "get": {
                "operationId": "reports.branch_profit",
                "description": "Lists, for each of your branches, what its delivered orders earned and what fell on it in the period: the cost of those orders, of its vehicles' empty trips, of their idle days and of the trips not yet delivered, the margin and its percent of the revenue. Orders of a branch-less vehicle appear under a null branch. Money is a list of lines, one per currency, never added across currencies. The period is whole Saudi days, at most a year; no driver is named.\n\nRequires the key scope `reporting:reports_branch_profit:read`.",
                "summary": "Read the branch profitability report",
                "tags": [
                    "BranchProfitReport"
                ],
                "parameters": [
                    {
                        "name": "from",
                        "in": "query",
                        "required": true,
                        "description": "Start of the period, ISO 8601 with an offset.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "required": true,
                        "description": "End of the period, after from and at most 366 days later; its Saudi day is included.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "branch",
                        "in": "query",
                        "description": "Only this branch (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "One page of branches; meta.withheld_trips counts trips left out because their orders may not be read.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "branch_uuid": "3f6b1c0e-8d2a-4c57-b1a9-6e0d4f7a2c11",
                                                    "delivered_orders": 40,
                                                    "unpriced_orders": 1,
                                                    "revenue": [
                                                        {
                                                            "currency": "SAR",
                                                            "amount": "120000.00"
                                                        }
                                                    ],
                                                    "order_cost": [
                                                        {
                                                            "currency": "SAR",
                                                            "amount": "70000.00"
                                                        }
                                                    ],
                                                    "empty_trips_cost": [],
                                                    "idle_cost": [
                                                        {
                                                            "currency": "SAR",
                                                            "amount": "4000.00"
                                                        }
                                                    ],
                                                    "unfinished_cost": [],
                                                    "margin": [
                                                        {
                                                            "currency": "SAR",
                                                            "amount": "46000.00"
                                                        }
                                                    ],
                                                    "margin_percent": [
                                                        {
                                                            "currency": "SAR",
                                                            "percent": "38.3"
                                                        }
                                                    ]
                                                }
                                            ],
                                            "meta": {
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                },
                                                "withheld_trips": 0
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": []
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "type": "string"
                                                        },
                                                        "timestamp": {
                                                            "type": "string"
                                                        },
                                                        "page": {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        "timezone": {
                                                            "type": "string"
                                                        },
                                                        "withheld_trips": {
                                                            "type": "integer"
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "page",
                                                        "timezone",
                                                        "withheld_trips"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    },
                                                    "minItems": 0,
                                                    "maxItems": 0
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "page": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "limit": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": "integer"
                                                                                },
                                                                                []
                                                                            ]
                                                                        },
                                                                        "next_cursor": []
                                                                    },
                                                                    "required": [
                                                                        "limit",
                                                                        "next_cursor"
                                                                    ],
                                                                    "additionalProperties": []
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timezone": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "page",
                                                        "timezone"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/maintenance/breakdowns": {
            "get": {
                "operationId": "maintenance.breakdowns.index",
                "description": "Lists, for each of your vehicles that had a breakdown repair in the period, the number of breakdowns, the defects by severity, the seconds it stood out of service (and, separately, the seconds estimated for stops whose return was not recorded) and the repeat faults. Most breakdowns first. A key limited to a branch sees that branch's vehicles only. Never an amount of money, a driver, a workshop or an order text. The period is required and at most 366 days.\n\nRequires the key scope `maintenance:read`.",
                "summary": "Read the breakdown figures of each vehicle",
                "tags": [
                    "BreakdownFigure"
                ],
                "parameters": [
                    {
                        "name": "from",
                        "in": "query",
                        "required": true,
                        "description": "Start of the period, ISO 8601 with an offset.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "required": true,
                        "description": "End of the period, after from and at most 366 days later.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of vehicles with their breakdown figures.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                    "breakdowns": 3,
                                                    "minor_defects": 1,
                                                    "major_defects": 2,
                                                    "critical_defects": 0,
                                                    "stopped_seconds": 172800,
                                                    "stops_without_return_recorded": 1,
                                                    "estimated_stopped_seconds": 43200,
                                                    "repeat_faults": 1
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/fleet/budget": {
            "get": {
                "operationId": "fleet.budget.index",
                "description": "Lists the budget lines of one year: for each cost kind (fuel, maintenance, expenses) and month that has an amount, the amount in minor units of its currency. The whole company is the default; vehicle_type narrows it to the lines set for one vehicle type. Only months with an amount appear. A key bound to a branch gets 403. Requires the key scope `fleet:budget:read`, whose owner must still see the budget on every call; every read is recorded.\n\nRequires the key scope `fleet:budget:read`.",
                "summary": "Read the company budget of a year",
                "tags": [
                    "Budget"
                ],
                "parameters": [
                    {
                        "name": "year",
                        "in": "query",
                        "required": true,
                        "description": "The calendar year, from 2020 to 2099.",
                        "schema": {
                            "type": "integer"
                        },
                        "example": 2026
                    },
                    {
                        "name": "vehicle_type",
                        "in": "query",
                        "description": "Only the lines set for this vehicle type, by its code.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "truck"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The budget lines of the year.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "cost_kind": "maintenance",
                                                    "month": "2026-01",
                                                    "currency": "SAR",
                                                    "amount_minor": 150000
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/buyers": {
            "get": {
                "operationId": "buyers.index",
                "description": "The names of the buyers your company keeps, one page at a time; archived buyers are left out. Identity numbers and phones are never shown. Needs the finance right over the whole company (403 otherwise); the reading is recorded.\n\nRequires the key scope `buyers:read`.",
                "summary": "List buyers",
                "tags": [
                    "Buyer"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of buyers.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "3f2b1c9e-8d47-4a6b-9c15-7e0a4d2b6f31",
                                                    "name": "Example Trading Co",
                                                    "created_at": "2026-05-12T12:00:00Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-14T12:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "post": {
                "operationId": "buyers.store",
                "description": "Keeps a buyer for your company, as the buyers page does: a name and optionally a phone. An identity number is never accepted over a key. A phone the company already keeps answers 422 without saying which buyer. The answer is the uuid and the name; the phone is never shown. Needs the finance right over the whole company (403 otherwise) and the Idempotency-Key header; 30 an hour per key.\n\nRequires the key scope `fleet:disposal:write`.",
                "summary": "Keep a buyer",
                "tags": [
                    "BuyerWrite"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/CreateBuyerRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "name": {
                                                "type": "string",
                                                "description": "The buyer's name; a text holding an identity or card number is refused.",
                                                "examples": [
                                                    "Example Trading Co"
                                                ]
                                            },
                                            "phone": {
                                                "type": "string",
                                                "description": "An optional phone, digits with an optional leading plus.",
                                                "examples": [
                                                    "+966500000000"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "name"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The buyer that was kept.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "3f2b1c9e-8d47-4a6b-9c15-7e0a4d2b6f31",
                                                "name": "Example Trading Co",
                                                "created_at": "2026-05-12T12:00:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-14T12:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uuid": {
                                                    "type": "string"
                                                },
                                                "name": {
                                                    "type": "string"
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "uuid",
                                                "name",
                                                "created_at"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/buyers/{uuid}": {
            "get": {
                "operationId": "buyers.show",
                "description": "One buyer your company keeps: the uuid and the name. Identity numbers and phones are never shown. Needs the finance right over the whole company (403 otherwise); a buyer of another company or an archived one answers 404; the reading is recorded.\n\nRequires the key scope `buyers:read`.",
                "summary": "Read a buyer",
                "tags": [
                    "Buyer"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The buyer.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "3f2b1c9e-8d47-4a6b-9c15-7e0a4d2b6f31",
                                                "name": "Example Trading Co",
                                                "created_at": "2026-05-12T12:00:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-14T12:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "name",
                                                        "created_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/roadside/cases": {
            "get": {
                "operationId": "roadside.cases.index",
                "description": "Lists your company's roadside assistance cases, oldest first, one page at a time. Each carries the vehicle, what stopped it, its urgency, its state and where and when it happened; the free-text note and the people are never included.\n\nRequires the key scope `assistance:cases:read`.",
                "summary": "List roadside cases",
                "tags": [
                    "Case"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only cases in this state: reported, requested, accepted, en_route, on_site, done or cancelled.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "accepted"
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only cases changed at or after this moment (ISO 8601 with an offset, e.g. 2026-05-01T00:00:00Z).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of roadside cases.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "5b1d7a20-3c4e-4f6a-9d11-8e2a0c7b6f33",
                                                    "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                    "status": "accepted",
                                                    "symptom": "engine",
                                                    "urgency": "high",
                                                    "can_move": "no",
                                                    "need": "tow",
                                                    "outcome": null,
                                                    "lat": "24.713600",
                                                    "lng": "46.675300",
                                                    "expected_resume_at": null,
                                                    "opened_at": "2026-06-01T08:12:00Z",
                                                    "closed_at": null,
                                                    "created_at": "2026-06-01T08:12:05Z",
                                                    "updated_at": "2026-06-01T08:20:41Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "post": {
                "operationId": "roadside.cases.store",
                "description": "Opens a roadside case for one of your company's vehicles, with the same rules as the panel: the vehicle must be yours and not archived, and a vehicle that already has an open case joins it (the answer is that case, status 200; a new case answers 201). A vehicle of another company or one that does not exist answers 404. Send an `Idempotency-Key` so a retry never opens twice.\n\nRequires the key scope `assistance:cases:write`.",
                "summary": "Open a roadside case",
                "tags": [
                    "CaseWrite"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/OpenCaseRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "vehicle_uuid": {
                                                "type": "string",
                                                "description": "The vehicle, as the vehicles endpoint returns it.",
                                                "examples": [
                                                    "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11"
                                                ]
                                            },
                                            "symptom": {
                                                "type": "string",
                                                "description": "What is wrong: engine, tyres, brakes, electrical, battery, fuel, accident or other.",
                                                "examples": [
                                                    "engine"
                                                ]
                                            },
                                            "can_move": {
                                                "type": "string",
                                                "description": "Whether the vehicle can still be driven: yes, no or unknown (the default).",
                                                "examples": [
                                                    "no"
                                                ]
                                            },
                                            "note": {
                                                "type": "string",
                                                "description": "Plain text up to 500 characters; it goes on the case timeline.",
                                                "examples": [
                                                    "Warning light and loss of power"
                                                ]
                                            },
                                            "lat": {
                                                "type": "object",
                                                "description": "Latitude of the vehicle; left out, the last fix of the vehicle is used. Send it with `lng`.",
                                                "examples": [
                                                    24.7136
                                                ]
                                            },
                                            "lng": {
                                                "type": "object",
                                                "description": "Longitude of the vehicle; send it with `lat`.",
                                                "examples": [
                                                    46.6753
                                                ]
                                            }
                                        },
                                        "required": [
                                            "vehicle_uuid",
                                            "symptom"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "201": {
                        "description": "The new case.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "5b1d7a20-3c4e-4f6a-9d11-8e2a0c7b6f33",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "status": "accepted",
                                                "symptom": "engine",
                                                "urgency": "high",
                                                "can_move": "no",
                                                "need": "tow",
                                                "outcome": null,
                                                "lat": "24.713600",
                                                "lng": "46.675300",
                                                "expected_resume_at": null,
                                                "opened_at": "2026-06-01T08:12:00Z",
                                                "closed_at": null,
                                                "created_at": "2026-06-01T08:12:05Z",
                                                "updated_at": "2026-06-01T08:20:41Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/roadside/cases/{uuid}": {
            "get": {
                "operationId": "roadside.cases.show",
                "description": "Reads one of your company's roadside cases by its uuid. A case of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `assistance:cases:read`.",
                "summary": "Read a roadside case",
                "tags": [
                    "Case"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The case.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "5b1d7a20-3c4e-4f6a-9d11-8e2a0c7b6f33",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "status": "accepted",
                                                "symptom": "engine",
                                                "urgency": "high",
                                                "can_move": "no",
                                                "need": "tow",
                                                "outcome": null,
                                                "lat": "24.713600",
                                                "lng": "46.675300",
                                                "expected_resume_at": null,
                                                "opened_at": "2026-06-01T08:12:00Z",
                                                "closed_at": null,
                                                "created_at": "2026-06-01T08:12:05Z",
                                                "updated_at": "2026-06-01T08:20:41Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "additionalProperties": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/roadside/cases/{uuid}/cancel": {
            "post": {
                "operationId": "roadside.cases.cancel",
                "description": "Cancels one of your company's roadside cases that is not finished and has no responder on the way, with the reason; the driver and the staff of the case are told. A case whose responder is accepted, on the way or on site answers 409 responder_dispatched: it is ended in the panel. Send the `row_version` you read: a case changed meanwhile answers 409. A case of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `assistance:cases:write`.",
                "summary": "Cancel a roadside case",
                "tags": [
                    "CaseWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/CancelCaseRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The version of the case you read.",
                                                "examples": [
                                                    3
                                                ]
                                            },
                                            "reason": {
                                                "type": "string",
                                                "description": "Why the case is cancelled, plain text up to 500 characters; it goes on the case timeline and is never returned by the read endpoints.",
                                                "examples": [
                                                    "The vehicle started again"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version",
                                            "reason"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The case after the change.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "5b1d7a20-3c4e-4f6a-9d11-8e2a0c7b6f33",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "status": "accepted",
                                                "symptom": "engine",
                                                "urgency": "high",
                                                "can_move": "no",
                                                "need": "tow",
                                                "outcome": null,
                                                "lat": "24.713600",
                                                "lng": "46.675300",
                                                "expected_resume_at": null,
                                                "opened_at": "2026-06-01T08:12:00Z",
                                                "closed_at": null,
                                                "created_at": "2026-06-01T08:12:05Z",
                                                "updated_at": "2026-06-01T08:20:41Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "vehicle_uuid": {
                                                            "type": "string"
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "symptom": {
                                                            "type": "string"
                                                        },
                                                        "urgency": {
                                                            "type": "string"
                                                        },
                                                        "can_move": {
                                                            "type": "string"
                                                        },
                                                        "need": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "outcome": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "lat": {
                                                            "type": "string"
                                                        },
                                                        "lng": {
                                                            "type": "string"
                                                        },
                                                        "expected_resume_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "opened_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "closed_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "vehicle_uuid",
                                                        "status",
                                                        "symptom",
                                                        "urgency",
                                                        "can_move",
                                                        "need",
                                                        "outcome",
                                                        "lat",
                                                        "lng",
                                                        "expected_resume_at",
                                                        "opened_at",
                                                        "closed_at",
                                                        "created_at",
                                                        "updated_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/roadside/cases/{uuid}/advance": {
            "post": {
                "operationId": "roadside.cases.advance",
                "description": "Moves one of your company's roadside cases to its next state (reported, requested, accepted, en_route, on_site); the last step, done, is the close and is not available here. Send the `row_version` you read: a case changed meanwhile answers 409. A case of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `assistance:cases:write`.",
                "summary": "Move a roadside case to its next state",
                "tags": [
                    "CaseWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/AdvanceCaseRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The version of the case you read.",
                                                "examples": [
                                                    3
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The case after the change.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "5b1d7a20-3c4e-4f6a-9d11-8e2a0c7b6f33",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "status": "accepted",
                                                "symptom": "engine",
                                                "urgency": "high",
                                                "can_move": "no",
                                                "need": "tow",
                                                "outcome": null,
                                                "lat": "24.713600",
                                                "lng": "46.675300",
                                                "expected_resume_at": null,
                                                "opened_at": "2026-06-01T08:12:00Z",
                                                "closed_at": null,
                                                "created_at": "2026-06-01T08:12:05Z",
                                                "updated_at": "2026-06-01T08:20:41Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "vehicle_uuid": {
                                                            "type": "string"
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "symptom": {
                                                            "type": "string"
                                                        },
                                                        "urgency": {
                                                            "type": "string"
                                                        },
                                                        "can_move": {
                                                            "type": "string"
                                                        },
                                                        "need": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "outcome": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "lat": {
                                                            "type": "string"
                                                        },
                                                        "lng": {
                                                            "type": "string"
                                                        },
                                                        "expected_resume_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "opened_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "closed_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "vehicle_uuid",
                                                        "status",
                                                        "symptom",
                                                        "urgency",
                                                        "can_move",
                                                        "need",
                                                        "outcome",
                                                        "lat",
                                                        "lng",
                                                        "expected_resume_at",
                                                        "opened_at",
                                                        "closed_at",
                                                        "created_at",
                                                        "updated_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/roadside/cases/{uuid}/close": {
            "post": {
                "operationId": "roadside.cases.close",
                "description": "Closes one of your company's roadside cases that is on site, with how it ended. Nothing else is created: a corrective work order is opened in the panel. Send the `row_version` you read: a case changed meanwhile answers 409. A case of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `assistance:cases:write`.",
                "summary": "Close a roadside case",
                "tags": [
                    "CaseWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/CloseCaseRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The version of the case you read.",
                                                "examples": [
                                                    3
                                                ]
                                            },
                                            "outcome": {
                                                "type": "string",
                                                "description": "How the case ended: repaired_on_site, towed_and_repaired, swapped or false_alarm.",
                                                "examples": [
                                                    "repaired_on_site"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version",
                                            "outcome"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The case after the change.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "5b1d7a20-3c4e-4f6a-9d11-8e2a0c7b6f33",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "status": "accepted",
                                                "symptom": "engine",
                                                "urgency": "high",
                                                "can_move": "no",
                                                "need": "tow",
                                                "outcome": null,
                                                "lat": "24.713600",
                                                "lng": "46.675300",
                                                "expected_resume_at": null,
                                                "opened_at": "2026-06-01T08:12:00Z",
                                                "closed_at": null,
                                                "created_at": "2026-06-01T08:12:05Z",
                                                "updated_at": "2026-06-01T08:20:41Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "vehicle_uuid": {
                                                            "type": "string"
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "symptom": {
                                                            "type": "string"
                                                        },
                                                        "urgency": {
                                                            "type": "string"
                                                        },
                                                        "can_move": {
                                                            "type": "string"
                                                        },
                                                        "need": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "outcome": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "lat": {
                                                            "type": "string"
                                                        },
                                                        "lng": {
                                                            "type": "string"
                                                        },
                                                        "expected_resume_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "opened_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "closed_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "vehicle_uuid",
                                                        "status",
                                                        "symptom",
                                                        "urgency",
                                                        "can_move",
                                                        "need",
                                                        "outcome",
                                                        "lat",
                                                        "lng",
                                                        "expected_resume_at",
                                                        "opened_at",
                                                        "closed_at",
                                                        "created_at",
                                                        "updated_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/roadside/cases/{uuid}/notes": {
            "post": {
                "operationId": "roadside.cases.note",
                "description": "Puts a short note on the timeline of one of your company's roadside cases that is not finished, as the panel does; it changes no state. A finished case answers 409 final. A case of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `assistance:cases:write`.",
                "summary": "Add a note to a roadside case",
                "tags": [
                    "CaseWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/AddCaseNoteRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "note": {
                                                "type": "string",
                                                "description": "Plain text up to 500 characters, with no card number; it goes on the case timeline and is never returned by the read endpoints.",
                                                "examples": [
                                                    "The driver is waiting at the fuel station"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "note"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The case after the note.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "5b1d7a20-3c4e-4f6a-9d11-8e2a0c7b6f33",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "status": "accepted",
                                                "symptom": "engine",
                                                "urgency": "high",
                                                "can_move": "no",
                                                "need": "tow",
                                                "outcome": null,
                                                "lat": "24.713600",
                                                "lng": "46.675300",
                                                "expected_resume_at": null,
                                                "opened_at": "2026-06-01T08:12:00Z",
                                                "closed_at": null,
                                                "created_at": "2026-06-01T08:12:05Z",
                                                "updated_at": "2026-06-01T08:20:41Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "vehicle_uuid": {
                                                            "type": "string"
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "symptom": {
                                                            "type": "string"
                                                        },
                                                        "urgency": {
                                                            "type": "string"
                                                        },
                                                        "can_move": {
                                                            "type": "string"
                                                        },
                                                        "need": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "outcome": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "lat": {
                                                            "type": "string"
                                                        },
                                                        "lng": {
                                                            "type": "string"
                                                        },
                                                        "expected_resume_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "opened_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "closed_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "vehicle_uuid",
                                                        "status",
                                                        "symptom",
                                                        "urgency",
                                                        "can_move",
                                                        "need",
                                                        "outcome",
                                                        "lat",
                                                        "lng",
                                                        "expected_resume_at",
                                                        "opened_at",
                                                        "closed_at",
                                                        "created_at",
                                                        "updated_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/vehicle-catalogue/requests": {
            "post": {
                "operationId": "vehicle_catalogue.requests.store",
                "description": "Files a request to add a make, a model or a vehicle type the catalogue lacks, for Tawasul staff to decide; the vehicle catalogue itself is not changed. The answer is `filed` (a new request), or `known` when an approved value or alias already names the text, and the same limits as the panel apply: 429 with the reason `pending_cap` or `daily_cap`. Requires the key scope `fleet:vehicles:write`, its owner's right to update vehicles, and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:vehicles:write`.",
                "summary": "Ask the catalogue for a missing make, model or type",
                "tags": [
                    "CatalogRequest"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/CatalogRequestInput"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "list": {
                                                "type": "string",
                                                "description": "make, model or vehicle_type.",
                                                "examples": [
                                                    "make"
                                                ]
                                            },
                                            "text": {
                                                "type": "string",
                                                "description": "The name as you write it, up to 160 characters of plain text.",
                                                "examples": [
                                                    "Hino"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "list",
                                            "text"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "201": {
                        "description": "The request was filed or the value is already known.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "state": "filed"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "state": {
                                                    "type": "string",
                                                    "enum": [
                                                        "filed",
                                                        "daily_cap",
                                                        "pending_cap",
                                                        "known"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "state"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/drivers/licence-classes": {
            "get": {
                "operationId": "drivers.licence_classes.index",
                "description": "Lists the active driving licence classes by code, one page at a time, with the minimum age and the heaviest gross weight each allows.\n\nRequires the key scope `drivers:read`.",
                "summary": "List driving licence classes",
                "tags": [
                    "CatalogueList"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of licence classes.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "code": "heavy",
                                                    "name_ar": "ثقيل",
                                                    "name_en": "Heavy",
                                                    "min_age": 21,
                                                    "max_gross_kg": null
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "string"
                                            }
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/inspections/templates": {
            "get": {
                "operationId": "inspections.templates.index",
                "description": "Lists the active inspection checklists by code, one page at a time; read one by its code to get its items.\n\nRequires the key scope `inspections:read`.",
                "summary": "List inspection templates",
                "tags": [
                    "CatalogueList"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of inspection templates.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "code": "pre_trip",
                                                    "name_ar": "فحص قبل الرحلة",
                                                    "name_en": "Pre-trip check"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "string"
                                            }
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/inspections/templates/{code}": {
            "get": {
                "operationId": "inspections.templates.show",
                "description": "Reads one active inspection checklist by its code, with its active items in order. An unknown or switched-off code answers 404.\n\nRequires the key scope `inspections:read`.",
                "summary": "Read an inspection template",
                "tags": [
                    "CatalogueList"
                ],
                "parameters": [
                    {
                        "name": "code",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The template with its items.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "code": "pre_trip",
                                                "name_ar": "فحص قبل الرحلة",
                                                "name_en": "Pre-trip check",
                                                "items": [
                                                    {
                                                        "code": "tyres",
                                                        "name_ar": "الإطارات",
                                                        "name_en": "Tyres"
                                                    }
                                                ]
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "name_ar": {
                                                    "type": "string"
                                                },
                                                "name_en": {
                                                    "type": "string"
                                                },
                                                "items": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                }
                                            },
                                            "required": [
                                                "code",
                                                "name_ar",
                                                "name_en",
                                                "items"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/defects/causes": {
            "get": {
                "operationId": "defects.causes.index",
                "description": "Lists the active failure causes by code, one page at a time.\n\nRequires the key scope `defects:read`.",
                "summary": "List failure causes",
                "tags": [
                    "CatalogueList"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of failure causes.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "code": "unknown",
                                                    "name_ar": "غير معروف",
                                                    "name_en": "Unknown"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "string"
                                            }
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/maintenance/categories": {
            "get": {
                "operationId": "maintenance.categories.index",
                "description": "Lists the active maintenance categories by code, one page at a time.\n\nRequires the key scope `maintenance:read`.",
                "summary": "List maintenance categories",
                "tags": [
                    "CatalogueList"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of maintenance categories.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "code": "oil_change",
                                                    "name_ar": "تغيير الزيت",
                                                    "name_en": "Oil change"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "string"
                                            }
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/expenses/types": {
            "get": {
                "operationId": "expenses.types.index",
                "description": "Lists the active expense types by code, one page at a time: the platform's own and the ones your company added for itself; another company's types are never shown.\n\nRequires the key scope `expenses:read`.",
                "summary": "List expense types",
                "tags": [
                    "CatalogueList"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of expense types.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "code": "fuel",
                                                    "name_ar": "وقود",
                                                    "name_en": "Fuel",
                                                    "own": false
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "string"
                                            }
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "post": {
                "operationId": "expenses.types.create",
                "description": "Adds an expense type of your own company, named in Arabic and optionally in English, as the panel does: it then appears in the list of expense types and can be used when recording an expense. A name your company already has is refused. Send an Idempotency-Key header so a retry does not add it twice. Requires the key scope `fleet:expenses:write`.\n\nRequires the key scope `fleet:expenses:write`.",
                "summary": "Add an expense type",
                "tags": [
                    "ExpenseTypeWrite"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/ExpenseTypeRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "name_ar": {
                                                "type": "string",
                                                "description": "The name in Arabic, up to 120 characters.",
                                                "examples": [
                                                    "رسوم موقف"
                                                ]
                                            },
                                            "name_en": {
                                                "type": "string",
                                                "description": "The name in English, up to 120 characters and with no Arabic letters.",
                                                "examples": [
                                                    "Parking fees"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "name_ar"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The type that was added, with the code to use when recording an expense.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "code": "c12_a1b2c3d4",
                                                "name_ar": "رسوم موقف",
                                                "name_en": "Parking fees",
                                                "is_active": true
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "name_ar": {
                                                    "type": "string"
                                                },
                                                "name_en": {
                                                    "type": "string"
                                                },
                                                "is_active": {
                                                    "type": "boolean"
                                                }
                                            },
                                            "required": [
                                                "code",
                                                "name_ar",
                                                "name_en",
                                                "is_active"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/vehicle-catalogue/colours": {
            "get": {
                "operationId": "vehicle_catalogue.colours.index",
                "description": "Lists the active vehicle colours by code, one page at a time, each with its swatch.\n\nRequires the key scope `vehicles:read`.",
                "summary": "List vehicle colours",
                "tags": [
                    "CatalogueList"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of colours.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "code": "white",
                                                    "name_ar": "أبيض",
                                                    "name_en": "White",
                                                    "hex": "#FFFFFF"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "string"
                                            }
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/vehicle-catalogue/fuel-types": {
            "get": {
                "operationId": "vehicle_catalogue.fuel_types.index",
                "description": "Lists the active fuel types by code, one page at a time.\n\nRequires the key scope `vehicles:read`.",
                "summary": "List fuel types",
                "tags": [
                    "CatalogueList"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of fuel types.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "code": "diesel",
                                                    "name_ar": "ديزل",
                                                    "name_en": "Diesel"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "string"
                                            }
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/vehicle-catalogue/categories": {
            "get": {
                "operationId": "vehicle_catalogue.categories.index",
                "description": "Lists the active vehicle categories by code, one page at a time, with the weight and seat bounds that only suggest a category.\n\nRequires the key scope `vehicles:read`.",
                "summary": "List vehicle categories",
                "tags": [
                    "CatalogueList"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of vehicle categories.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "code": "heavy_truck",
                                                    "name_ar": "شاحنة ثقيلة",
                                                    "name_en": "Heavy truck",
                                                    "min_gross_kg": 7500,
                                                    "max_gross_kg": null,
                                                    "min_seats": null,
                                                    "max_seats": null,
                                                    "is_equipment": false
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "string"
                                            }
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/collection-runs": {
            "get": {
                "operationId": "collection_runs.index",
                "description": "Lists your company's collection runs, oldest first, one page at a time, with how many of each run's containers are done, skipped or waiting. A branch-limited key sees only its own branch. The driver, the vehicle, the notes and any position are never returned.\n\nRequires the key scope `waste:runs:read`.",
                "summary": "List collection runs",
                "tags": [
                    "CollectionRun"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only runs in this state.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "in_progress"
                    },
                    {
                        "name": "branch",
                        "in": "query",
                        "description": "Only runs of this branch (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only runs changed at or after this moment (ISO 8601 with an offset); a moment older than 92 days reads as 92 days ago.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of collection runs.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "7c2e9d10-4a6b-4f83-9b15-0d3e8a1c5f67",
                                                    "name": "North districts, Sunday morning",
                                                    "status": "in_progress",
                                                    "planned_for": "2026-06-01",
                                                    "planned_time": "06:00:00",
                                                    "scheduled": true,
                                                    "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                    "stops_total": 24,
                                                    "stops_done": 9,
                                                    "stops_skipped": 1,
                                                    "stops_pending": 14,
                                                    "started_at": "2026-06-01T03:05:10Z",
                                                    "completed_at": null,
                                                    "created_at": "2026-05-31T12:00:00Z",
                                                    "updated_at": "2026-06-01T05:40:00Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": []
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "page": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "limit": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": "integer"
                                                                                },
                                                                                []
                                                                            ]
                                                                        },
                                                                        "next_cursor": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": [
                                                                                        "string",
                                                                                        "null"
                                                                                    ]
                                                                                },
                                                                                []
                                                                            ]
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "limit",
                                                                        "next_cursor"
                                                                    ],
                                                                    "additionalProperties": []
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timezone": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "page",
                                                        "timezone"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/collection-runs/{uuid}": {
            "get": {
                "operationId": "collection_runs.show",
                "description": "Reads one of your company's collection runs by its uuid. A run of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `waste:runs:read`.",
                "summary": "Read a collection run",
                "tags": [
                    "CollectionRun"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The collection run.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "7c2e9d10-4a6b-4f83-9b15-0d3e8a1c5f67",
                                                "name": "North districts, Sunday morning",
                                                "status": "in_progress",
                                                "planned_for": "2026-06-01",
                                                "planned_time": "06:00:00",
                                                "scheduled": true,
                                                "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                "stops_total": 24,
                                                "stops_done": 9,
                                                "stops_skipped": 1,
                                                "stops_pending": 14,
                                                "started_at": "2026-06-01T03:05:10Z",
                                                "completed_at": null,
                                                "created_at": "2026-05-31T12:00:00Z",
                                                "updated_at": "2026-06-01T05:40:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "additionalProperties": []
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "type": "string"
                                                        },
                                                        "timestamp": {
                                                            "type": "string"
                                                        },
                                                        "timezone": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "timezone"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/command-batches": {
            "get": {
                "operationId": "command_batches.index",
                "description": "Lists the commands sent to many devices at once, oldest first, one page at a time, with how many lines ended in each state. You see the batches your key's owner started; a company administrator sees all of the company's. Device identities and command values are never returned.\n\nRequires the key scope `command_batches:read`.",
                "summary": "List bulk commands",
                "tags": [
                    "CommandBatch"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only batches in this state.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "running"
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only batches created at or after this moment (ISO 8601 with an offset).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of bulk commands.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "2f9a6e41-5c07-4d8b-a3e2-9b1c7d4f8e60",
                                                    "command": "Request position",
                                                    "state": "finished",
                                                    "total": 40,
                                                    "lines": {
                                                        "queued": 0,
                                                        "sending": 0,
                                                        "accepted": 37,
                                                        "unconfirmed": 1,
                                                        "refused": 1,
                                                        "not_linked": 1,
                                                        "cancelled": 0
                                                    },
                                                    "created_at": "2026-11-14T08:30:00Z",
                                                    "finished_at": "2026-11-14T11:10:00Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-14T12:00:00Z",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/command-batches/{uuid}": {
            "get": {
                "operationId": "command_batches.show",
                "description": "Reads one bulk command by its uuid with its lines: each line's device brand and model, state and a closed reason code (never the IMEI, which needs the devices scope). A batch you may not see answers 404 exactly like one that does not exist.\n\nRequires the key scope `command_batches:read`.",
                "summary": "Read a bulk command",
                "tags": [
                    "CommandBatch"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The bulk command with its lines.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "2f9a6e41-5c07-4d8b-a3e2-9b1c7d4f8e60",
                                                "command": "Request position",
                                                "state": "finished",
                                                "total": 40,
                                                "lines": {
                                                    "queued": 0,
                                                    "sending": 0,
                                                    "accepted": 37,
                                                    "unconfirmed": 1,
                                                    "refused": 1,
                                                    "not_linked": 1,
                                                    "cancelled": 0
                                                },
                                                "created_at": "2026-11-14T08:30:00Z",
                                                "finished_at": "2026-11-14T11:10:00Z",
                                                "device_lines": [
                                                    {
                                                        "line": 1,
                                                        "device": "Teltonika FMC130",
                                                        "state": "accepted",
                                                        "reason": null
                                                    }
                                                ]
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-14T12:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uuid": {
                                                    "type": "string"
                                                },
                                                "command": {
                                                    "type": "string"
                                                },
                                                "state": {
                                                    "type": "string"
                                                },
                                                "total": {
                                                    "type": "integer"
                                                },
                                                "lines": {
                                                    "type": "array",
                                                    "items": []
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "finished_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "device_lines": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                }
                                            },
                                            "required": [
                                                "uuid",
                                                "command",
                                                "state",
                                                "total",
                                                "lines",
                                                "created_at",
                                                "finished_at",
                                                "device_lines"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/reports": {
            "get": {
                "operationId": "reports.index",
                "description": "Lists the reports this key may read now: those its owner could export to Excel at this moment (the same rights, plan and readiness), with their filters and columns. Profit, ranking and screen-only reports are never listed; the fuel and impact reports are read on their own addresses.\n\nRequires the key scope `reporting:company_reports:read`.",
                "summary": "List readable reports",
                "tags": [
                    "CompanyReport"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The readable reports.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "key": "maintenance_costs",
                                                    "title": "Maintenance costs",
                                                    "family": "fleet_cost",
                                                    "filters": [
                                                        "period",
                                                        "branch",
                                                        "vehicle"
                                                    ],
                                                    "period_required": true,
                                                    "max_days": 92,
                                                    "columns": [
                                                        {
                                                            "key": "plate",
                                                            "label": "Plate"
                                                        },
                                                        {
                                                            "key": "total",
                                                            "label": "Total"
                                                        }
                                                    ]
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "key": {
                                                        "type": "string"
                                                    },
                                                    "title": {
                                                        "type": "string"
                                                    },
                                                    "family": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "filters": {
                                                        "type": "array",
                                                        "items": []
                                                    },
                                                    "period_required": {
                                                        "type": "boolean"
                                                    },
                                                    "max_days": {
                                                        "type": "integer",
                                                        "const": 366
                                                    },
                                                    "columns": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "object",
                                                            "properties": {
                                                                "key": {
                                                                    "type": "string"
                                                                },
                                                                "label": {
                                                                    "type": "string"
                                                                }
                                                            },
                                                            "required": [
                                                                "key",
                                                                "label"
                                                            ]
                                                        }
                                                    },
                                                    "groupings": {
                                                        "type": "array",
                                                        "items": []
                                                    },
                                                    "searchable": {
                                                        "type": "boolean"
                                                    },
                                                    "sortable": {
                                                        "type": "array",
                                                        "items": []
                                                    },
                                                    "compare": {
                                                        "type": "array",
                                                        "items": []
                                                    }
                                                },
                                                "required": [
                                                    "key",
                                                    "title",
                                                    "family",
                                                    "filters",
                                                    "period_required",
                                                    "max_days",
                                                    "columns",
                                                    "groupings",
                                                    "searchable",
                                                    "sortable",
                                                    "compare"
                                                ]
                                            }
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFoundHttpException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/reports/{key}": {
            "get": {
                "operationId": "reports.show",
                "description": "Reads one page of a report with the columns and cells its owner's Excel export would carry; personal data stays masked. A report the key may not read answers 404 exactly like one that does not exist. Every read is recorded as an export. The rows returned count against a daily budget of the key and of the company; once one is spent the answer is 429 with Retry-After. Since 2026-11-15 a query key this endpoint does not list answers 422 (validation_failed, the key named in error.details) instead of being ignored.\n\nRequires the key scope `reporting:company_reports:read`.",
                "summary": "Read a report",
                "tags": [
                    "CompanyReport"
                ],
                "parameters": [
                    {
                        "name": "key",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "from",
                        "in": "query",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "format": "date"
                        }
                    },
                    {
                        "name": "until",
                        "in": "query",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "format": "date"
                        }
                    },
                    {
                        "name": "branch",
                        "in": "query",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "vehicle",
                        "in": "query",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "driver",
                        "in": "query",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "category",
                        "in": "query",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "maxLength": 60
                        }
                    },
                    {
                        "name": "group",
                        "in": "query",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "pattern": "^[a-z][a-z0-9_]{0,39}$"
                        }
                    },
                    {
                        "name": "search",
                        "in": "query",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "minLength": 2,
                            "maxLength": 100
                        }
                    },
                    {
                        "name": "sort",
                        "in": "query",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "pattern": "^[a-z][a-z0-9_]{0,59}$"
                        }
                    },
                    {
                        "name": "direction",
                        "in": "query",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "enum": [
                                "asc",
                                "desc",
                                null
                            ]
                        }
                    },
                    {
                        "name": "compare",
                        "in": "query",
                        "schema": {
                            "anyOf": [
                                {
                                    "$ref": "#/components/schemas/ComparisonKind"
                                },
                                {
                                    "type": "null"
                                }
                            ]
                        }
                    },
                    {
                        "name": "baseline_from",
                        "in": "query",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "format": "date"
                        }
                    },
                    {
                        "name": "baseline_until",
                        "in": "query",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "format": "date"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100000
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "view",
                        "in": "query",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "pattern": "^[A-Za-z0-9_-]{22}$"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "One page of the report.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "key": "maintenance_costs",
                                                "title": "Maintenance costs",
                                                "columns": [
                                                    {
                                                        "key": "plate",
                                                        "label": "Plate"
                                                    }
                                                ],
                                                "rows": [
                                                    {
                                                        "plate": "ABC 1234"
                                                    }
                                                ],
                                                "notices": [],
                                                "period": {
                                                    "from": "2026-05-01",
                                                    "until": "2026-05-31"
                                                },
                                                "data_as_of": null
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "page": 1,
                                                    "per_page": 50,
                                                    "has_more": false
                                                }
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "key": {
                                                            "type": "string"
                                                        },
                                                        "title": {
                                                            "type": "string"
                                                        },
                                                        "columns": {
                                                            "type": "array",
                                                            "items": {
                                                                "type": "object",
                                                                "properties": {
                                                                    "key": {
                                                                        "type": "string"
                                                                    },
                                                                    "label": {
                                                                        "type": "string"
                                                                    }
                                                                },
                                                                "required": [
                                                                    "key",
                                                                    "label"
                                                                ]
                                                            }
                                                        },
                                                        "rows": {
                                                            "type": "array",
                                                            "items": []
                                                        },
                                                        "notices": {
                                                            "type": "array",
                                                            "items": {
                                                                "type": "string"
                                                            }
                                                        },
                                                        "period": {
                                                            "type": [
                                                                "object",
                                                                "null"
                                                            ],
                                                            "properties": {
                                                                "from": {
                                                                    "type": "string"
                                                                },
                                                                "until": {
                                                                    "type": "string"
                                                                }
                                                            },
                                                            "required": [
                                                                "from",
                                                                "until"
                                                            ]
                                                        },
                                                        "comparison": {
                                                            "type": [
                                                                "object",
                                                                "null"
                                                            ],
                                                            "properties": {
                                                                "kind": {
                                                                    "type": "string"
                                                                },
                                                                "from": {
                                                                    "type": "string"
                                                                },
                                                                "until": {
                                                                    "type": "string"
                                                                }
                                                            },
                                                            "required": [
                                                                "kind",
                                                                "from",
                                                                "until"
                                                            ]
                                                        },
                                                        "data_as_of": {
                                                            "type": "null"
                                                        }
                                                    },
                                                    "required": [
                                                        "key",
                                                        "title",
                                                        "columns",
                                                        "rows",
                                                        "notices",
                                                        "period",
                                                        "comparison",
                                                        "data_as_of"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "type": "string"
                                                        },
                                                        "timestamp": {
                                                            "type": "string"
                                                        },
                                                        "page": {
                                                            "type": "object",
                                                            "properties": {
                                                                "page": {
                                                                    "type": [
                                                                        "integer",
                                                                        "string"
                                                                    ]
                                                                },
                                                                "per_page": {
                                                                    "type": [
                                                                        "integer",
                                                                        "string"
                                                                    ]
                                                                },
                                                                "has_more": {
                                                                    "type": [
                                                                        "boolean",
                                                                        "string"
                                                                    ]
                                                                },
                                                                "sort_capped": {
                                                                    "type": "string"
                                                                }
                                                            },
                                                            "required": [
                                                                "page",
                                                                "per_page",
                                                                "has_more",
                                                                "sort_capped"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "page"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/reports/{key}/views": {
            "get": {
                "operationId": "reports.views",
                "description": "Lists the saved views the key's owner made of this report in the portal, each with an opaque handle to pass as view= when reading it. Another person's views are never listed, and a report the key may not read answers 404.\n\nRequires the key scope `reporting:company_reports:read`.",
                "summary": "List my saved views of a report",
                "tags": [
                    "CompanyReport"
                ],
                "parameters": [
                    {
                        "name": "key",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The owner's own saved views of the report.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "handle": "Qm9vay1yZXBvcnQtdmlldw",
                                                    "name": "Riyadh branch, last month",
                                                    "is_default": false
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "post": {
                "operationId": "reports.views.store",
                "description": "Saves the filters given (the read's own: period, branch, vehicle and driver by uuid, category, group, search, sort, compare) as one of your views of the report, under a plain name; it opens in the portal too and reads back with view=. At most 50 views of one report; at most 6 pinned. Send an Idempotency-Key header.\n\nRequires the key scope `reporting:report_views:write`.",
                "summary": "Save a view of a report",
                "tags": [
                    "CompanyReportViewWrite"
                ],
                "parameters": [
                    {
                        "name": "key",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/CompanyReportViewRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "name": {
                                                "type": "string",
                                                "description": "A plain name, 1 to 60 characters; no card number.",
                                                "examples": [
                                                    "Weekly, Riyadh branch"
                                                ]
                                            },
                                            "is_default": {
                                                "type": "boolean",
                                                "description": "True to open this view first for you.",
                                                "examples": [
                                                    false
                                                ]
                                            }
                                        },
                                        "required": [
                                            "name"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The saved view; its handle names it in every next call.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "handle": "Vmlldy1vZi1hLXJlcG9ydA",
                                                "name": "Weekly, Riyadh branch",
                                                "is_default": false,
                                                "pinned": false
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "handle": {
                                                    "type": "string"
                                                },
                                                "name": {
                                                    "type": "string"
                                                },
                                                "is_default": {
                                                    "type": "boolean"
                                                },
                                                "pinned": {
                                                    "type": "boolean"
                                                }
                                            },
                                            "required": [
                                                "handle",
                                                "name",
                                                "is_default",
                                                "pinned"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/reports/{key}/charts": {
            "get": {
                "operationId": "reports.charts",
                "description": "The charts the portal draws for the report with the same filters (and view=), in your own scope: what to draw and its numbers. A chart grouped by a named driver is never given; at most 20 charts of at most 500 points, and the points count against the daily row budget. Recorded as a read.\n\nRequires the key scope `reporting:company_reports:read`.",
                "summary": "Read a report's charts",
                "tags": [
                    "CompanyReport"
                ],
                "parameters": [
                    {
                        "name": "key",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "from",
                        "in": "query",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "format": "date"
                        }
                    },
                    {
                        "name": "until",
                        "in": "query",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "format": "date"
                        }
                    },
                    {
                        "name": "branch",
                        "in": "query",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "vehicle",
                        "in": "query",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "driver",
                        "in": "query",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "category",
                        "in": "query",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "maxLength": 60
                        }
                    },
                    {
                        "name": "group",
                        "in": "query",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "pattern": "^[a-z][a-z0-9_]{0,39}$"
                        }
                    },
                    {
                        "name": "search",
                        "in": "query",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "minLength": 2,
                            "maxLength": 100
                        }
                    },
                    {
                        "name": "sort",
                        "in": "query",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "pattern": "^[a-z][a-z0-9_]{0,59}$"
                        }
                    },
                    {
                        "name": "direction",
                        "in": "query",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "enum": [
                                "asc",
                                "desc",
                                null
                            ]
                        }
                    },
                    {
                        "name": "compare",
                        "in": "query",
                        "schema": {
                            "anyOf": [
                                {
                                    "$ref": "#/components/schemas/ComparisonKind"
                                },
                                {
                                    "type": "null"
                                }
                            ]
                        }
                    },
                    {
                        "name": "baseline_from",
                        "in": "query",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "format": "date"
                        }
                    },
                    {
                        "name": "baseline_until",
                        "in": "query",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "format": "date"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100000
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "view",
                        "in": "query",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "pattern": "^[A-Za-z0-9_-]{22}$"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The charts of the report for the period, each with what to draw and its numbers.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "key": "maintenance_costs",
                                                "title": "Maintenance costs",
                                                "period": {
                                                    "from": "2026-05-01",
                                                    "until": "2026-06-01"
                                                },
                                                "charts": [
                                                    {
                                                        "kind": "columns",
                                                        "title": "Cost by month",
                                                        "labels": [
                                                            "Mar",
                                                            "Apr",
                                                            "May"
                                                        ],
                                                        "series": [
                                                            {
                                                                "label": "SAR",
                                                                "values": [
                                                                    1200,
                                                                    980.5,
                                                                    1430
                                                                ],
                                                                "tone": "primary",
                                                                "xs": null,
                                                                "targets": null,
                                                                "estimated": false
                                                            }
                                                        ],
                                                        "unit": "SAR",
                                                        "decimals": 2,
                                                        "note": null,
                                                        "point_titles": null,
                                                        "lower_is_better": true,
                                                        "bands": [],
                                                        "reference": null,
                                                        "x_title": null,
                                                        "y_title": null
                                                    }
                                                ]
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "key": {
                                                            "type": "string"
                                                        },
                                                        "title": {
                                                            "type": "string"
                                                        },
                                                        "period": {
                                                            "type": [
                                                                "object",
                                                                "null"
                                                            ],
                                                            "properties": {
                                                                "from": {
                                                                    "type": "string"
                                                                },
                                                                "until": {
                                                                    "type": "string"
                                                                }
                                                            },
                                                            "required": [
                                                                "from",
                                                                "until"
                                                            ]
                                                        },
                                                        "charts": {
                                                            "type": "array",
                                                            "items": []
                                                        }
                                                    },
                                                    "required": [
                                                        "key",
                                                        "title",
                                                        "period",
                                                        "charts"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/reports/{key}/files": {
            "post": {
                "operationId": "reports.files.store",
                "description": "Starts a file of the report with the read's own filters and a reason of 10 to 500 characters, built like the portal's Excel export with personal data masked; it is ready within minutes in every format the plan allows. Answers 404 while report files by key are off. Capped per company a day and by the restricted exports' own caps; one file at a time per person. Send an Idempotency-Key header.\n\nRequires the key scope `reporting:report_files:write`.",
                "summary": "Start a report file",
                "tags": [
                    "CompanyReportFile"
                ],
                "parameters": [
                    {
                        "name": "key",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/CompanyReportFileRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "reason": {
                                                "type": "string",
                                                "description": "Why the file is wanted, 10 to 500 characters of plain text; it is kept with the key in the privileged-read record.",
                                                "examples": [
                                                    "Monthly maintenance review with the workshop"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "reason"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "The file, queued; read its handle until the state is ready.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "handle": "RmlsZS1vZi1hLXJlcG9ydA",
                                                "report": "maintenance_costs",
                                                "report_title": "Maintenance costs",
                                                "state": "queued",
                                                "reason": null,
                                                "formats": [],
                                                "rows": 0,
                                                "created_at": "2026-06-01T09:00:00Z",
                                                "expires_at": null
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "handle": {
                                                    "type": "string"
                                                },
                                                "report": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "report_title": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "state": {
                                                    "type": "string"
                                                },
                                                "reason": {
                                                    "type": "string"
                                                },
                                                "formats": {
                                                    "type": "array",
                                                    "items": []
                                                },
                                                "rows": {
                                                    "type": "integer"
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "expires_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "handle",
                                                "report",
                                                "report_title",
                                                "state",
                                                "reason",
                                                "formats",
                                                "rows",
                                                "created_at",
                                                "expires_at"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/report-files/{handle}": {
            "get": {
                "operationId": "report_files.show",
                "description": "One of your report files: queued, ready (with the formats to download), expired once its retention ends, or failed with a closed code. Another person's file answers 404 exactly like one that does not exist.\n\nRequires the key scope `reporting:report_files:write`.",
                "summary": "Read a report file's state",
                "tags": [
                    "CompanyReportFile"
                ],
                "parameters": [
                    {
                        "name": "handle",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The file with its state and, when ready, the formats to download.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "handle": "RmlsZS1vZi1hLXJlcG9ydA",
                                                "report": "maintenance_costs",
                                                "report_title": "Maintenance costs",
                                                "state": "ready",
                                                "reason": null,
                                                "formats": [
                                                    "csv",
                                                    "xlsx"
                                                ],
                                                "rows": 128,
                                                "created_at": "2026-06-01T09:00:00Z",
                                                "expires_at": "2026-06-08T09:00:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "handle": {
                                                    "type": "string"
                                                },
                                                "report": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "report_title": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "state": {
                                                    "type": "string"
                                                },
                                                "reason": {
                                                    "type": "string"
                                                },
                                                "formats": {
                                                    "type": "array",
                                                    "items": []
                                                },
                                                "rows": {
                                                    "type": "integer"
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "expires_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "handle",
                                                "report",
                                                "report_title",
                                                "state",
                                                "reason",
                                                "formats",
                                                "rows",
                                                "created_at",
                                                "expires_at"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/report-files/{handle}/download": {
            "get": {
                "operationId": "report_files.download",
                "description": "Streams one of your ready report files in the format asked (one of the formats its state lists) to you alone; there is no link to share. A format not built answers 422; a file past its retention answers 410. Each download counts its rows against the reports API's daily row budget, and the cap on downloads counts every format of the file together.\n\nRequires the key scope `reporting:report_files:write`.",
                "summary": "Download a report file",
                "tags": [
                    "CompanyReportFile"
                ],
                "parameters": [
                    {
                        "name": "handle",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "format",
                        "in": "query",
                        "required": true,
                        "description": "The format to download, one of the formats the state lists: csv or xlsx.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "xlsx"
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The file, in the format asked.",
                        "content": {
                            "application/octet-stream": {
                                "schema": {
                                    "type": "string",
                                    "format": "binary"
                                }
                            },
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            },
                            "text/csv": {
                                "schema": {
                                    "type": "string"
                                }
                            },
                            "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
                                "schema": {
                                    "type": "string",
                                    "format": "binary"
                                }
                            }
                        },
                        "headers": {
                            "Transfer-Encoding": {
                                "schema": {
                                    "type": "string",
                                    "enum": [
                                        "chunked"
                                    ]
                                }
                            }
                        }
                    },
                    "410": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "null"
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                },
                                                "reason": {
                                                    "type": "string",
                                                    "const": "expired"
                                                },
                                                "details": {
                                                    "type": "string"
                                                },
                                                "data": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "code",
                                                "message",
                                                "reason",
                                                "details",
                                                "data"
                                            ]
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/report-schedules": {
            "get": {
                "operationId": "report_schedules.index",
                "description": "Lists the company's scheduled reports for a key whose owner may manage them, as the portal shows them (a branch-bound owner sees only the schedules they created). Each carries how many people receive it, never who, and how many external contacts it e-mails (their uuids only to a key whose owner may view contacts, else null); a pause is a code: by_person, plan, driver_data, failing (paused after three failed sends in a row) or other. A query key not listed here answers 422.\n\nRequires the key scope `reporting:report_schedules:read`.",
                "summary": "List scheduled reports",
                "tags": [
                    "CompanyReportSchedule"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "One page of scheduled reports.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "handle": "Qm9vay1yZXBvcnQtdmlldw",
                                                    "report": "maintenance_costs",
                                                    "report_title": "Maintenance costs",
                                                    "format": "pdf",
                                                    "cadence": "weekly",
                                                    "weekday": 7,
                                                    "month_day": null,
                                                    "send_hour": 7,
                                                    "period": "previous",
                                                    "locale": "ar",
                                                    "skip_when_empty": false,
                                                    "recipients_count": 3,
                                                    "contacts_count": 1,
                                                    "contacts": [
                                                        "9b2f4e8a-1c3d-4e5f-8a7b-6c5d4e3f2a1b"
                                                    ],
                                                    "is_mine": true,
                                                    "state": "active",
                                                    "pause": null,
                                                    "next_run_at": "2026-06-07T04:00:00Z",
                                                    "last_status": "sent",
                                                    "last_run_at": "2026-05-31T04:00:12Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFoundHttpException"
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "post": {
                "operationId": "report_schedules.store",
                "description": "Creates a scheduled report under the portal's own rules. Recipients are user uuids of company users who may read the report; a report that names a driver is never scheduled. contacts (optional, at most 5) are uuids of the company's external contacts, only for a report that may leave the company, only while the platform and the company allow it (403 otherwise), and each receives files only after confirming from their own mailbox. Send an Idempotency-Key header; writes are capped per key an hour and per company a day.\n\nRequires the key scope `reporting:report_schedules:write`.",
                "summary": "Create a scheduled report",
                "tags": [
                    "CompanyReportScheduleWrite"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "report": {
                                        "type": "string",
                                        "description": "The report key, from GET /reports; a report that names a driver is never scheduled.",
                                        "examples": [
                                            "fuel"
                                        ]
                                    },
                                    "format": {
                                        "type": "string",
                                        "description": "pdf, xlsx or csv.",
                                        "examples": [
                                            "xlsx"
                                        ]
                                    },
                                    "cadence": {
                                        "type": "string",
                                        "description": "daily, weekly, monthly, quarterly or yearly.",
                                        "examples": [
                                            "weekly"
                                        ]
                                    },
                                    "weekday": {
                                        "type": "integer",
                                        "description": "For weekly: 1 (Monday) to 7 (Sunday).",
                                        "examples": [
                                            7
                                        ]
                                    },
                                    "send_hour": {
                                        "type": "integer",
                                        "description": "The hour it goes, 0 to 23, Saudi time.",
                                        "examples": [
                                            7
                                        ]
                                    },
                                    "period": {
                                        "type": "string",
                                        "description": "previous (the last complete period) or to_date (from the start of the current one to yesterday).",
                                        "examples": [
                                            "previous"
                                        ]
                                    }
                                },
                                "required": [
                                    "report",
                                    "format",
                                    "cadence",
                                    "send_hour"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The schedule as saved; its handle names it in every next call.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "handle": "Qm9vay1yZXBvcnQtdmlldw",
                                                "report": "maintenance_costs",
                                                "report_title": "Maintenance costs",
                                                "format": "pdf",
                                                "cadence": "weekly",
                                                "weekday": 7,
                                                "month_day": null,
                                                "send_hour": 7,
                                                "period": "previous",
                                                "locale": "ar",
                                                "skip_when_empty": false,
                                                "recipients_count": 3,
                                                "contacts_count": 1,
                                                "contacts": [
                                                    "9b2f4e8a-1c3d-4e5f-8a7b-6c5d4e3f2a1b"
                                                ],
                                                "is_mine": true,
                                                "state": "active",
                                                "pause": null,
                                                "next_run_at": "2026-06-07T04:00:00Z",
                                                "last_status": "sent",
                                                "last_run_at": "2026-05-31T04:00:12Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": [],
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/report-schedules/{handle}": {
            "patch": {
                "operationId": "report_schedules.update",
                "description": "Changes the fields sent; a field left out keeps its value (period: previous, the last complete period, or to_date, from the start of the current week, month, quarter or year to yesterday; daily schedules always send yesterday), and a filter sent as null is removed. Another company's schedule answers 404 exactly like one that does not exist.\n\nRequires the key scope `reporting:report_schedules:write`.",
                "summary": "Edit a scheduled report",
                "tags": [
                    "CompanyReportScheduleWrite"
                ],
                "parameters": [
                    {
                        "name": "handle",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "report": {
                                        "type": "string",
                                        "description": "The report key, from GET /reports; a report that names a driver is never scheduled.",
                                        "examples": [
                                            "fuel"
                                        ]
                                    },
                                    "format": {
                                        "type": "string",
                                        "description": "pdf, xlsx or csv.",
                                        "examples": [
                                            "xlsx"
                                        ]
                                    },
                                    "cadence": {
                                        "type": "string",
                                        "description": "daily, weekly, monthly, quarterly or yearly.",
                                        "examples": [
                                            "weekly"
                                        ]
                                    },
                                    "weekday": {
                                        "type": "integer",
                                        "description": "For weekly: 1 (Monday) to 7 (Sunday).",
                                        "examples": [
                                            7
                                        ]
                                    },
                                    "send_hour": {
                                        "type": "integer",
                                        "description": "The hour it goes, 0 to 23, Saudi time.",
                                        "examples": [
                                            7
                                        ]
                                    },
                                    "period": {
                                        "type": "string",
                                        "description": "previous (the last complete period) or to_date (from the start of the current one to yesterday).",
                                        "examples": [
                                            "previous"
                                        ]
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The schedule as changed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "handle": "Qm9vay1yZXBvcnQtdmlldw",
                                                "report": "maintenance_costs",
                                                "report_title": "Maintenance costs",
                                                "format": "pdf",
                                                "cadence": "weekly",
                                                "weekday": 7,
                                                "month_day": null,
                                                "send_hour": 7,
                                                "period": "previous",
                                                "locale": "ar",
                                                "skip_when_empty": false,
                                                "recipients_count": 3,
                                                "contacts_count": 1,
                                                "contacts": [
                                                    "9b2f4e8a-1c3d-4e5f-8a7b-6c5d4e3f2a1b"
                                                ],
                                                "is_mine": true,
                                                "state": "active",
                                                "pause": null,
                                                "next_run_at": "2026-06-07T04:00:00Z",
                                                "last_status": "sent",
                                                "last_run_at": "2026-05-31T04:00:12Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": [],
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "delete": {
                "operationId": "report_schedules.destroy",
                "description": "Deletes it; its past sends stay in the company's log.\n\nRequires the key scope `reporting:report_schedules:write`.",
                "summary": "Delete a scheduled report",
                "tags": [
                    "CompanyReportScheduleWrite"
                ],
                "parameters": [
                    {
                        "name": "handle",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No content"
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/report-schedules/{handle}/pause": {
            "post": {
                "operationId": "report_schedules.pause",
                "description": "Pauses it with a reason of 3 to 500 characters; the reason is kept for the portal and never returned (the list shows the pause as by_person).\n\nRequires the key scope `reporting:report_schedules:write`.",
                "summary": "Pause a scheduled report",
                "tags": [
                    "CompanyReportScheduleWrite"
                ],
                "parameters": [
                    {
                        "name": "handle",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "reason": {
                                        "type": "string",
                                        "description": "Why it is paused, 3 to 500 characters of plain text; kept for the portal and never returned.",
                                        "examples": [
                                            "The workshop is closed for the holiday"
                                        ]
                                    }
                                },
                                "required": [
                                    "reason"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The schedule, paused.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "handle": "Qm9vay1yZXBvcnQtdmlldw",
                                                "report": "maintenance_costs",
                                                "report_title": "Maintenance costs",
                                                "format": "pdf",
                                                "cadence": "weekly",
                                                "weekday": 7,
                                                "month_day": null,
                                                "send_hour": 7,
                                                "period": "previous",
                                                "locale": "ar",
                                                "skip_when_empty": false,
                                                "recipients_count": 3,
                                                "contacts_count": 1,
                                                "contacts": [
                                                    "9b2f4e8a-1c3d-4e5f-8a7b-6c5d4e3f2a1b"
                                                ],
                                                "is_mine": true,
                                                "state": "paused",
                                                "pause": "by_person",
                                                "next_run_at": null,
                                                "last_status": "sent",
                                                "last_run_at": "2026-05-31T04:00:12Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": [],
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/report-schedules/{handle}/resume": {
            "post": {
                "operationId": "report_schedules.resume",
                "description": "Resumes a paused scheduled report from its next send; a pause the plan or the driver data protection made ends only when they allow it again.\n\nRequires the key scope `reporting:report_schedules:write`.",
                "summary": "Resume a scheduled report",
                "tags": [
                    "CompanyReportScheduleWrite"
                ],
                "parameters": [
                    {
                        "name": "handle",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The schedule, running again from its next send.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "handle": "Qm9vay1yZXBvcnQtdmlldw",
                                                "report": "maintenance_costs",
                                                "report_title": "Maintenance costs",
                                                "format": "pdf",
                                                "cadence": "weekly",
                                                "weekday": 7,
                                                "month_day": null,
                                                "send_hour": 7,
                                                "period": "previous",
                                                "locale": "ar",
                                                "skip_when_empty": false,
                                                "recipients_count": 3,
                                                "contacts_count": 1,
                                                "contacts": [
                                                    "9b2f4e8a-1c3d-4e5f-8a7b-6c5d4e3f2a1b"
                                                ],
                                                "is_mine": true,
                                                "state": "active",
                                                "pause": null,
                                                "next_run_at": "2026-06-07T04:00:00Z",
                                                "last_status": "sent",
                                                "last_run_at": "2026-05-31T04:00:12Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": [],
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/report-schedules/{handle}/test": {
            "post": {
                "operationId": "report_schedules.test",
                "description": "Queues the last complete period to the key's owner alone, marked as a test copy; it never counts as the period's send. Capped per schedule an hour and per company a day.\n\nRequires the key scope `reporting:report_schedules:write`.",
                "summary": "Send a test of a scheduled report",
                "tags": [
                    "CompanyReportScheduleWrite"
                ],
                "parameters": [
                    {
                        "name": "handle",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "description": "The test copy is queued for the key's owner.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "queued": true
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "queued": {
                                                    "type": "boolean"
                                                }
                                            },
                                            "required": [
                                                "queued"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/reports/{key}/views/{handle}": {
            "patch": {
                "operationId": "reports.views.update",
                "description": "Changes the name and/or is_default of one of your views; its filters stay. Another person's view answers 404 exactly like one that does not exist.\n\nRequires the key scope `reporting:report_views:write`.",
                "summary": "Rename a view or make it the default",
                "tags": [
                    "CompanyReportViewWrite"
                ],
                "parameters": [
                    {
                        "name": "key",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "handle",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "description": "The new name, 1 to 60 characters.",
                                        "examples": [
                                            "Monthly, all branches"
                                        ]
                                    },
                                    "is_default": {
                                        "type": "boolean",
                                        "description": "True to make it the default, false to clear it.",
                                        "examples": [
                                            true
                                        ]
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The view as changed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "handle": "Vmlldy1vZi1hLXJlcG9ydA",
                                                "name": "Weekly, Riyadh branch",
                                                "is_default": false,
                                                "pinned": false
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "handle": {
                                                    "type": "string"
                                                },
                                                "name": {
                                                    "type": "string"
                                                },
                                                "is_default": {
                                                    "type": "boolean"
                                                },
                                                "pinned": {
                                                    "type": "boolean"
                                                }
                                            },
                                            "required": [
                                                "handle",
                                                "name",
                                                "is_default",
                                                "pinned"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "delete": {
                "operationId": "reports.views.destroy",
                "description": "Deletes one of your views of the report.\n\nRequires the key scope `reporting:report_views:write`.",
                "summary": "Delete a view",
                "tags": [
                    "CompanyReportViewWrite"
                ],
                "parameters": [
                    {
                        "name": "key",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "handle",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No content"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/reports/{key}/views/{handle}/pin": {
            "put": {
                "operationId": "reports.views.pin",
                "description": "Pins one of your views to your portal home; at most 6 pins, a seventh answers 409 with reason pin_limit.\n\nRequires the key scope `reporting:report_views:write`.",
                "summary": "Pin a view to the home page",
                "tags": [
                    "CompanyReportViewWrite"
                ],
                "parameters": [
                    {
                        "name": "key",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "handle",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The view, now pinned.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "handle": "Vmlldy1vZi1hLXJlcG9ydA",
                                                "name": "Weekly, Riyadh branch",
                                                "is_default": false,
                                                "pinned": true
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "handle": {
                                                            "type": "string"
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        },
                                                        "is_default": {
                                                            "type": "boolean"
                                                        },
                                                        "pinned": {
                                                            "type": "boolean"
                                                        }
                                                    },
                                                    "required": [
                                                        "handle",
                                                        "name",
                                                        "is_default",
                                                        "pinned"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "type": "string"
                                                        },
                                                        "timestamp": {
                                                            "type": "string"
                                                        },
                                                        "timezone": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "timezone"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "delete": {
                "operationId": "reports.views.unpin",
                "description": "Takes one of your views off your portal home.\n\nRequires the key scope `reporting:report_views:write`.",
                "summary": "Unpin a view",
                "tags": [
                    "CompanyReportViewWrite"
                ],
                "parameters": [
                    {
                        "name": "key",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "handle",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The view, no longer pinned.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "handle": "Vmlldy1vZi1hLXJlcG9ydA",
                                                "name": "Weekly, Riyadh branch",
                                                "is_default": false,
                                                "pinned": false
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "handle": {
                                                    "type": "string"
                                                },
                                                "name": {
                                                    "type": "string"
                                                },
                                                "is_default": {
                                                    "type": "boolean"
                                                },
                                                "pinned": {
                                                    "type": "boolean"
                                                }
                                            },
                                            "required": [
                                                "handle",
                                                "name",
                                                "is_default",
                                                "pinned"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/tasks": {
            "get": {
                "operationId": "tasks.index",
                "description": "Lists your company's tasks, open ones first by default, one page at a time; ask status=closed or status=cancelled for the finished ones. A key whose owner may not assign tasks sees only the tasks given to that person. Times are UTC; meta.timezone names the platform time zone.\n\nRequires the key scope `tasks:tasks:read`.",
                "summary": "List tasks",
                "tags": [
                    "CompanyTask"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only tasks in this state: open, in_progress, waiting_external, closed or cancelled.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "open"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of tasks.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "7c1d2e44-5b6a-4f0e-9a3b-1d2c3e4f5a66",
                                                    "number": "TSK-000123",
                                                    "title": "Renew the vehicle insurance",
                                                    "instructions": "Bring the new policy to the office.",
                                                    "status": "open",
                                                    "due_at": "2026-06-10T09:00:00Z",
                                                    "overdue": false,
                                                    "assigned_at": null,
                                                    "closed_at": null,
                                                    "version": 1,
                                                    "created_at": "2026-06-01T08:00:00Z",
                                                    "updated_at": "2026-06-01T08:00:00Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "post": {
                "operationId": "tasks.store",
                "description": "Opens a company task in your company with a title, optional instructions and an optional due time. Send an Idempotency-Key header. The task has no assignee yet; the company is the key's own and no other field is accepted. Answers 429 when the key has opened its hourly allowance or the company its daily one.\n\nRequires the key scope `tasks:tasks:write`.",
                "summary": "Create a task",
                "tags": [
                    "CompanyTaskWrite"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/CompanyTaskCreateRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "title": {
                                                "type": "string",
                                                "description": "What to do, plain text, up to 250 characters.",
                                                "examples": [
                                                    "Renew the vehicle insurance"
                                                ]
                                            },
                                            "instructions": {
                                                "type": "string",
                                                "description": "Details, plain text, up to 5000 characters.",
                                                "examples": [
                                                    "Bring the new policy to the office."
                                                ]
                                            },
                                            "due_at": {
                                                "type": "string",
                                                "format": "date-time",
                                                "description": "When it is due, ISO 8601 with an offset, from a day ago to two years ahead.",
                                                "examples": [
                                                    "2026-06-10T09:00:00Z"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "title"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The new task; its version is the token for the next change.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "7c1d2e44-5b6a-4f0e-9a3b-1d2c3e4f5a66",
                                                "number": "TSK-000123",
                                                "title": "Renew the vehicle insurance",
                                                "instructions": "Bring the new policy to the office.",
                                                "status": "open",
                                                "due_at": "2026-06-10T09:00:00Z",
                                                "overdue": false,
                                                "assigned_at": null,
                                                "closed_at": null,
                                                "version": 1,
                                                "created_at": "2026-06-01T08:00:00Z",
                                                "updated_at": "2026-06-01T08:00:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uuid": {
                                                    "type": "string"
                                                },
                                                "number": {
                                                    "type": "string"
                                                },
                                                "title": {
                                                    "type": "string"
                                                },
                                                "instructions": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "status": {
                                                    "type": "string"
                                                },
                                                "due_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "overdue": {
                                                    "type": "string"
                                                },
                                                "assigned_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "closed_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "version": {
                                                    "type": "string"
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "uuid",
                                                "number",
                                                "title",
                                                "instructions",
                                                "status",
                                                "due_at",
                                                "overdue",
                                                "assigned_at",
                                                "closed_at",
                                                "version",
                                                "created_at",
                                                "updated_at"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/tasks/{uuid}": {
            "get": {
                "operationId": "tasks.show",
                "description": "Reads one of your company's tasks by its uuid. A task of another company, one outside what the key's owner may see and an unknown uuid all answer 404.\n\nRequires the key scope `tasks:tasks:read`.",
                "summary": "Read a task",
                "tags": [
                    "CompanyTask"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The task.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "7c1d2e44-5b6a-4f0e-9a3b-1d2c3e4f5a66",
                                                "number": "TSK-000123",
                                                "title": "Renew the vehicle insurance",
                                                "instructions": "Bring the new policy to the office.",
                                                "status": "open",
                                                "due_at": "2026-06-10T09:00:00Z",
                                                "overdue": false,
                                                "assigned_at": null,
                                                "closed_at": null,
                                                "version": 1,
                                                "created_at": "2026-06-01T08:00:00Z",
                                                "updated_at": "2026-06-01T08:00:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "additionalProperties": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "patch": {
                "operationId": "tasks.update",
                "description": "Changes the title, the instructions and the due time of an unfinished task of your company; the key's owner must be allowed to assign tasks. Send the `version` you read: a task changed meanwhile answers 409. Requires the key scope `tasks:tasks:write` and an `Idempotency-Key` header.\n\nRequires the key scope `tasks:tasks:write`.",
                "summary": "Edit a task",
                "tags": [
                    "CompanyTaskMove"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/CompanyTaskMoveRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "version": {
                                                "type": "integer",
                                                "description": "The version of the task you read.",
                                                "examples": [
                                                    1
                                                ]
                                            },
                                            "title": {
                                                "type": "string",
                                                "description": "What to do, plain text, up to 250 characters.",
                                                "examples": [
                                                    "Renew the vehicle insurance"
                                                ]
                                            },
                                            "instructions": {
                                                "type": "string",
                                                "description": "Details, plain text, up to 5000 characters; empty clears them.",
                                                "examples": [
                                                    "Bring the new policy to the office."
                                                ]
                                            },
                                            "due_at": {
                                                "type": "string",
                                                "format": "date-time",
                                                "description": "When it is due, ISO 8601 with an offset; empty clears it.",
                                                "examples": [
                                                    "2026-06-10T09:00:00Z"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "version",
                                            "title"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The task after the change.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "7c1d2e44-5b6a-4f0e-9a3b-1d2c3e4f5a66",
                                                "number": "TSK-000123",
                                                "title": "Renew the vehicle insurance",
                                                "instructions": "Bring the new policy to the office.",
                                                "status": "open",
                                                "due_at": "2026-06-10T09:00:00Z",
                                                "overdue": false,
                                                "assigned_at": null,
                                                "closed_at": null,
                                                "version": 1,
                                                "created_at": "2026-06-01T08:00:00Z",
                                                "updated_at": "2026-06-01T08:00:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "number": {
                                                            "type": "string"
                                                        },
                                                        "title": {
                                                            "type": "string"
                                                        },
                                                        "instructions": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "due_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "overdue": {
                                                            "type": "string"
                                                        },
                                                        "assigned_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "closed_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "version": {
                                                            "type": "string"
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "number",
                                                        "title",
                                                        "instructions",
                                                        "status",
                                                        "due_at",
                                                        "overdue",
                                                        "assigned_at",
                                                        "closed_at",
                                                        "version",
                                                        "created_at",
                                                        "updated_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/tasks/{uuid}/comments": {
            "get": {
                "operationId": "tasks.comments.index",
                "description": "Lists the comments on one of your company's tasks, oldest first, up to 200. Requires the key scope `tasks:tasks:read`.\n\nRequires the key scope `tasks:tasks:read`.",
                "summary": "List the comments of a task",
                "tags": [
                    "CompanyTaskComment"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The comments.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "id": "0192a1b2-0000-7000-8000-000000000002",
                                                    "author": "Sara",
                                                    "body": "The policy is renewed.",
                                                    "created_at": "2026-06-01T09:00:00Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": []
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "post": {
                "operationId": "tasks.comments.store",
                "description": "Adds a comment to one of your company's tasks; the key's owner must be allowed to work or assign tasks. A comment is never changed afterwards. Requires the key scope `tasks:tasks:write` and an `Idempotency-Key` header.\n\nRequires the key scope `tasks:tasks:write`.",
                "summary": "Comment on a task",
                "tags": [
                    "CompanyTaskComment"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/CompanyTaskCommentRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "body": {
                                                "type": "string",
                                                "description": "The comment, plain text, up to 2000 characters.",
                                                "examples": [
                                                    "The policy is renewed."
                                                ]
                                            }
                                        },
                                        "required": [
                                            "body"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The new comment.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "id": "0192a1b2-0000-7000-8000-000000000002",
                                                "author": "Sara",
                                                "body": "The policy is renewed.",
                                                "created_at": "2026-06-01T09:00:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "created_at": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "created_at"
                                            ],
                                            "additionalProperties": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/tasks/assignees": {
            "get": {
                "operationId": "tasks.assignees",
                "description": "Lists the people of your company who can hold a task, each with the `id` to send when assigning; the key's owner must be allowed to assign tasks. Requires the key scope `tasks:tasks:read`.\n\nRequires the key scope `tasks:tasks:read`.",
                "summary": "List who a task can be given to",
                "tags": [
                    "CompanyTaskMove"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The people.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "id": "0192a1b2-0000-7000-8000-000000000001",
                                                    "name": "Sara"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "string"
                                                    },
                                                    "name": []
                                                },
                                                "required": [
                                                    "id",
                                                    "name"
                                                ]
                                            }
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/tasks/{uuid}/start": {
            "post": {
                "operationId": "tasks.start",
                "description": "Moves an open task to in progress, or resumes one that waits for a reply. The key's owner must be the person it is assigned to, or allowed to assign tasks. Send the `version` you read. Requires the key scope `tasks:tasks:write` and an `Idempotency-Key` header.\n\nRequires the key scope `tasks:tasks:write`.",
                "summary": "Start a task",
                "tags": [
                    "CompanyTaskMove"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/CompanyTaskMoveRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "version": {
                                                "type": "integer",
                                                "description": "The version of the task you read.",
                                                "examples": [
                                                    1
                                                ]
                                            }
                                        },
                                        "required": [
                                            "version"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The task after the change.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "7c1d2e44-5b6a-4f0e-9a3b-1d2c3e4f5a66",
                                                "number": "TSK-000123",
                                                "title": "Renew the vehicle insurance",
                                                "instructions": "Bring the new policy to the office.",
                                                "status": "open",
                                                "due_at": "2026-06-10T09:00:00Z",
                                                "overdue": false,
                                                "assigned_at": null,
                                                "closed_at": null,
                                                "version": 1,
                                                "created_at": "2026-06-01T08:00:00Z",
                                                "updated_at": "2026-06-01T08:00:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "number": {
                                                            "type": "string"
                                                        },
                                                        "title": {
                                                            "type": "string"
                                                        },
                                                        "instructions": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "due_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "overdue": {
                                                            "type": "string"
                                                        },
                                                        "assigned_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "closed_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "version": {
                                                            "type": "string"
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "number",
                                                        "title",
                                                        "instructions",
                                                        "status",
                                                        "due_at",
                                                        "overdue",
                                                        "assigned_at",
                                                        "closed_at",
                                                        "version",
                                                        "created_at",
                                                        "updated_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/tasks/{uuid}/wait": {
            "post": {
                "operationId": "tasks.wait",
                "description": "Moves a task in progress to waiting for an outside party. Send the `version` you read. Requires the key scope `tasks:tasks:write` and an `Idempotency-Key` header.\n\nRequires the key scope `tasks:tasks:write`.",
                "summary": "Mark a task as waiting for a reply",
                "tags": [
                    "CompanyTaskMove"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/CompanyTaskMoveRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "version": {
                                                "type": "integer",
                                                "description": "The version of the task you read.",
                                                "examples": [
                                                    2
                                                ]
                                            }
                                        },
                                        "required": [
                                            "version"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The task after the change.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "7c1d2e44-5b6a-4f0e-9a3b-1d2c3e4f5a66",
                                                "number": "TSK-000123",
                                                "title": "Renew the vehicle insurance",
                                                "instructions": "Bring the new policy to the office.",
                                                "status": "open",
                                                "due_at": "2026-06-10T09:00:00Z",
                                                "overdue": false,
                                                "assigned_at": null,
                                                "closed_at": null,
                                                "version": 1,
                                                "created_at": "2026-06-01T08:00:00Z",
                                                "updated_at": "2026-06-01T08:00:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "number": {
                                                            "type": "string"
                                                        },
                                                        "title": {
                                                            "type": "string"
                                                        },
                                                        "instructions": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "due_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "overdue": {
                                                            "type": "string"
                                                        },
                                                        "assigned_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "closed_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "version": {
                                                            "type": "string"
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "number",
                                                        "title",
                                                        "instructions",
                                                        "status",
                                                        "due_at",
                                                        "overdue",
                                                        "assigned_at",
                                                        "closed_at",
                                                        "version",
                                                        "created_at",
                                                        "updated_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/tasks/{uuid}/close": {
            "post": {
                "operationId": "tasks.close",
                "description": "Completes an unfinished task; a task that needs evidence or a verified external id is completed in the panel. Send the `version` you read. Requires the key scope `tasks:tasks:write` and an `Idempotency-Key` header.\n\nRequires the key scope `tasks:tasks:write`.",
                "summary": "Complete a task",
                "tags": [
                    "CompanyTaskMove"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/CompanyTaskMoveRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "version": {
                                                "type": "integer",
                                                "description": "The version of the task you read.",
                                                "examples": [
                                                    2
                                                ]
                                            }
                                        },
                                        "required": [
                                            "version"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The task after the change.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "7c1d2e44-5b6a-4f0e-9a3b-1d2c3e4f5a66",
                                                "number": "TSK-000123",
                                                "title": "Renew the vehicle insurance",
                                                "instructions": "Bring the new policy to the office.",
                                                "status": "open",
                                                "due_at": "2026-06-10T09:00:00Z",
                                                "overdue": false,
                                                "assigned_at": null,
                                                "closed_at": null,
                                                "version": 1,
                                                "created_at": "2026-06-01T08:00:00Z",
                                                "updated_at": "2026-06-01T08:00:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "number": {
                                                            "type": "string"
                                                        },
                                                        "title": {
                                                            "type": "string"
                                                        },
                                                        "instructions": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "due_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "overdue": {
                                                            "type": "string"
                                                        },
                                                        "assigned_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "closed_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "version": {
                                                            "type": "string"
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "number",
                                                        "title",
                                                        "instructions",
                                                        "status",
                                                        "due_at",
                                                        "overdue",
                                                        "assigned_at",
                                                        "closed_at",
                                                        "version",
                                                        "created_at",
                                                        "updated_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/tasks/{uuid}/assign": {
            "post": {
                "operationId": "tasks.assign",
                "description": "Gives an unfinished task to a person of your company, or takes it from the current one when `assignee` is null; the key's owner must be allowed to assign tasks. Send the `version` you read. Requires the key scope `tasks:tasks:write` and an `Idempotency-Key` header.\n\nRequires the key scope `tasks:tasks:write`.",
                "summary": "Give a task to a person",
                "tags": [
                    "CompanyTaskMove"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/CompanyTaskMoveRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "version": {
                                                "type": "integer",
                                                "description": "The version of the task you read.",
                                                "examples": [
                                                    1
                                                ]
                                            },
                                            "assignee": {
                                                "type": "string",
                                                "description": "The `id` of the person from the assignees list, or null for nobody.",
                                                "examples": [
                                                    "0192a1b2-0000-7000-8000-000000000001"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "version",
                                            "assignee"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The task after the change.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "7c1d2e44-5b6a-4f0e-9a3b-1d2c3e4f5a66",
                                                "number": "TSK-000123",
                                                "title": "Renew the vehicle insurance",
                                                "instructions": "Bring the new policy to the office.",
                                                "status": "open",
                                                "due_at": "2026-06-10T09:00:00Z",
                                                "overdue": false,
                                                "assigned_at": null,
                                                "closed_at": null,
                                                "version": 1,
                                                "created_at": "2026-06-01T08:00:00Z",
                                                "updated_at": "2026-06-01T08:00:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "number": {
                                                            "type": "string"
                                                        },
                                                        "title": {
                                                            "type": "string"
                                                        },
                                                        "instructions": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "due_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "overdue": {
                                                            "type": "string"
                                                        },
                                                        "assigned_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "closed_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "version": {
                                                            "type": "string"
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "number",
                                                        "title",
                                                        "instructions",
                                                        "status",
                                                        "due_at",
                                                        "overdue",
                                                        "assigned_at",
                                                        "closed_at",
                                                        "version",
                                                        "created_at",
                                                        "updated_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/tasks/{uuid}/cancel": {
            "post": {
                "operationId": "tasks.cancel",
                "description": "Cancels an unfinished task with a written reason of up to 1000 characters; the key's owner must be allowed to cancel tasks. Send the `version` you read. Requires the key scope `tasks:tasks:write` and an `Idempotency-Key` header.\n\nRequires the key scope `tasks:tasks:write`.",
                "summary": "Cancel a task",
                "tags": [
                    "CompanyTaskMove"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/CompanyTaskMoveRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "version": {
                                                "type": "integer",
                                                "description": "The version of the task you read.",
                                                "examples": [
                                                    2
                                                ]
                                            },
                                            "reason": {
                                                "type": "string",
                                                "description": "Why it is cancelled, plain text, up to 1000 characters.",
                                                "examples": [
                                                    "The vehicle was sold"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "version",
                                            "reason"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The task after the change.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "7c1d2e44-5b6a-4f0e-9a3b-1d2c3e4f5a66",
                                                "number": "TSK-000123",
                                                "title": "Renew the vehicle insurance",
                                                "instructions": "Bring the new policy to the office.",
                                                "status": "open",
                                                "due_at": "2026-06-10T09:00:00Z",
                                                "overdue": false,
                                                "assigned_at": null,
                                                "closed_at": null,
                                                "version": 1,
                                                "created_at": "2026-06-01T08:00:00Z",
                                                "updated_at": "2026-06-01T08:00:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "number": {
                                                            "type": "string"
                                                        },
                                                        "title": {
                                                            "type": "string"
                                                        },
                                                        "instructions": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "due_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "overdue": {
                                                            "type": "string"
                                                        },
                                                        "assigned_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "closed_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "version": {
                                                            "type": "string"
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "number",
                                                        "title",
                                                        "instructions",
                                                        "status",
                                                        "due_at",
                                                        "overdue",
                                                        "assigned_at",
                                                        "closed_at",
                                                        "version",
                                                        "created_at",
                                                        "updated_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/connections": {
            "get": {
                "operationId": "connections.index",
                "description": "Lists whether each of your company's tracking devices is online, offline or has never connected, and whether each tracking platform link (source) is healthy, one page at a time, oldest first. A device is online while its vehicle reported within the platform's online window. changed_at is when the state last changed; updated_since filters on it. A branch-limited key sees only the records of its own branch. The states are refreshed every five minutes, so a change shows up to five minutes late, and a device archived or moved to another branch stays visible to its old branch for that long. Times are UTC; meta.timezone names the platform time zone.\n\nRequires the key scope `connections:read`.",
                "summary": "List connection states",
                "tags": [
                    "Connection"
                ],
                "parameters": [
                    {
                        "name": "kind",
                        "in": "query",
                        "description": "Only devices (device) or only sources (source).",
                        "schema": {
                            "type": "string"
                        },
                        "example": "device"
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only records in this state: online, offline, never_connected, healthy or unhealthy.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "offline"
                    },
                    {
                        "name": "branch",
                        "in": "query",
                        "description": "Only records of this branch (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "vehicle",
                        "in": "query",
                        "description": "Only the device installed in this vehicle (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only records whose state changed at or after this moment (ISO 8601 with an offset, e.g. 2026-05-01T00:00:00Z).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of connection states.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "9e2b4d61-3f58-4c7a-b1d9-2a6c8e0f3b55",
                                                    "kind": "device",
                                                    "label": "356307042441013",
                                                    "state": "offline",
                                                    "last_seen_at": "2026-06-01T07:42:10Z",
                                                    "changed_at": "2026-06-01T07:55:00Z",
                                                    "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                    "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/connections/{uuid}": {
            "get": {
                "operationId": "connections.show",
                "description": "Reads the connection state of one of your company's devices or sources by its own uuid. A record of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `connections:read`.",
                "summary": "Read a connection state",
                "tags": [
                    "Connection"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The connection state.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "9e2b4d61-3f58-4c7a-b1d9-2a6c8e0f3b55",
                                                "kind": "device",
                                                "label": "356307042441013",
                                                "state": "offline",
                                                "last_seen_at": "2026-06-01T07:42:10Z",
                                                "changed_at": "2026-06-01T07:55:00Z",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "additionalProperties": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/containers": {
            "get": {
                "operationId": "containers.index",
                "description": "Lists your company's waste containers, oldest first, one page at a time, with the latest fill level, the battery and the kinds of alert open on each. Archived containers are left out unless you ask for status=archived. A branch-limited key sees only its own branch. A container's printed code, its report link and its photos are never returned.\n\nRequires the key scope `waste:containers:read`.",
                "summary": "List waste containers",
                "tags": [
                    "Container"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only containers in this state.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "active"
                    },
                    {
                        "name": "branch",
                        "in": "query",
                        "description": "Only containers of this branch (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only containers changed at or after this moment (ISO 8601 with an offset); a moment older than 92 days reads as 92 days ago.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of containers.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "3b1f6a52-9d4e-4c7b-8a10-5e2c7d9f0b44",
                                                    "status": "active",
                                                    "tag": "RYD-0142",
                                                    "name": "King Fahd Road, bin 142",
                                                    "type": "1,100 litre street bin",
                                                    "volume_litres": 1100,
                                                    "district": "Al Olaya",
                                                    "address": "King Fahd Road, Riyadh",
                                                    "latitude": "24.7136000",
                                                    "longitude": "46.6753000",
                                                    "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                    "fill_pct": "86.50",
                                                    "fill_observed_at": "2026-06-01T08:55:00Z",
                                                    "battery_pct": 74,
                                                    "predicted_full_at": "2026-06-02T06:00:00Z",
                                                    "open_alerts": [
                                                        "near_full"
                                                    ],
                                                    "archived_at": null,
                                                    "created_at": "2026-03-01T08:30:00Z",
                                                    "updated_at": "2026-06-01T08:55:12Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": []
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "page": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "limit": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": "integer"
                                                                                },
                                                                                []
                                                                            ]
                                                                        },
                                                                        "next_cursor": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": [
                                                                                        "string",
                                                                                        "null"
                                                                                    ]
                                                                                },
                                                                                []
                                                                            ]
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "limit",
                                                                        "next_cursor"
                                                                    ],
                                                                    "additionalProperties": []
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timezone": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "page",
                                                        "timezone"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/containers/{uuid}": {
            "get": {
                "operationId": "containers.show",
                "description": "Reads one of your company's waste containers by its uuid. A container of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `waste:containers:read`.",
                "summary": "Read a waste container",
                "tags": [
                    "Container"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The container.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "3b1f6a52-9d4e-4c7b-8a10-5e2c7d9f0b44",
                                                "status": "active",
                                                "tag": "RYD-0142",
                                                "name": "King Fahd Road, bin 142",
                                                "type": "1,100 litre street bin",
                                                "volume_litres": 1100,
                                                "district": "Al Olaya",
                                                "address": "King Fahd Road, Riyadh",
                                                "latitude": "24.7136000",
                                                "longitude": "46.6753000",
                                                "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                "fill_pct": "86.50",
                                                "fill_observed_at": "2026-06-01T08:55:00Z",
                                                "battery_pct": 74,
                                                "predicted_full_at": "2026-06-02T06:00:00Z",
                                                "open_alerts": [
                                                    "near_full"
                                                ],
                                                "archived_at": null,
                                                "created_at": "2026-03-01T08:30:00Z",
                                                "updated_at": "2026-06-01T08:55:12Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "additionalProperties": []
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "type": "string"
                                                        },
                                                        "timestamp": {
                                                            "type": "string"
                                                        },
                                                        "timezone": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "timezone"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/roadside/costs": {
            "get": {
                "operationId": "roadside.costs.index",
                "description": "Lists the invoices declared for your company's roadside cases, oldest first, one page at a time. Amounts and VAT are whole minor units (halalas) with the currency; the payee, the invoice number and file and the retract reason are never included. A day's reads are limited by a row budget per key and per company.\n\nRequires the key scope `assistance:case_costs:read`.",
                "summary": "List roadside invoices",
                "tags": [
                    "Cost"
                ],
                "parameters": [
                    {
                        "name": "case",
                        "in": "query",
                        "description": "Only the invoices of this case (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "kind",
                        "in": "query",
                        "description": "Only invoices of this kind: repair, tow or other.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "tow"
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only invoices declared or retracted at or after this moment (ISO 8601 with an offset), at most 366 days back.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of invoices.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "7c2e9b40-5d1a-4e8f-a3b6-0f9d2c4e1a55",
                                                    "case_uuid": "5b1d7a20-3c4e-4f6a-9d11-8e2a0c7b6f33",
                                                    "kind": "tow",
                                                    "invoice_on": "2026-06-02",
                                                    "amount_minor": 45000,
                                                    "vat_minor": 6750,
                                                    "total_minor": 51750,
                                                    "currency": "SAR",
                                                    "retracted": false,
                                                    "retracted_at": null,
                                                    "declared_at": "2026-06-02T09:30:00Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": []
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "page": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "limit": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": "integer"
                                                                                },
                                                                                []
                                                                            ]
                                                                        },
                                                                        "next_cursor": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": [
                                                                                        "string",
                                                                                        "null"
                                                                                    ]
                                                                                },
                                                                                []
                                                                            ]
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "limit",
                                                                        "next_cursor"
                                                                    ],
                                                                    "additionalProperties": []
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timezone": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "page",
                                                        "timezone"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/roadside/costs/{uuid}": {
            "get": {
                "operationId": "roadside.costs.show",
                "description": "Reads one invoice of your company's roadside cases by its uuid. An invoice of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `assistance:case_costs:read`.",
                "summary": "Read a roadside invoice",
                "tags": [
                    "Cost"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The invoice.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "7c2e9b40-5d1a-4e8f-a3b6-0f9d2c4e1a55",
                                                "case_uuid": "5b1d7a20-3c4e-4f6a-9d11-8e2a0c7b6f33",
                                                "kind": "tow",
                                                "invoice_on": "2026-06-02",
                                                "amount_minor": 45000,
                                                "vat_minor": 6750,
                                                "total_minor": 51750,
                                                "currency": "SAR",
                                                "retracted": false,
                                                "retracted_at": null,
                                                "declared_at": "2026-06-02T09:30:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "case_uuid": {
                                                            "type": "string"
                                                        },
                                                        "kind": {
                                                            "type": "string"
                                                        },
                                                        "invoice_on": {
                                                            "type": "string"
                                                        },
                                                        "amount_minor": {
                                                            "type": "integer"
                                                        },
                                                        "vat_minor": {
                                                            "type": "integer"
                                                        },
                                                        "total_minor": {
                                                            "type": "integer"
                                                        },
                                                        "currency": {
                                                            "type": "string"
                                                        },
                                                        "retracted": {
                                                            "type": "string"
                                                        },
                                                        "retracted_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "declared_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "case_uuid",
                                                        "kind",
                                                        "invoice_on",
                                                        "amount_minor",
                                                        "vat_minor",
                                                        "total_minor",
                                                        "currency",
                                                        "retracted",
                                                        "retracted_at",
                                                        "declared_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "type": "string"
                                                        },
                                                        "timestamp": {
                                                            "type": "string"
                                                        },
                                                        "timezone": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "timezone"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/roadside/cases/{uuid}/costs": {
            "post": {
                "operationId": "roadside.costs.store",
                "description": "Declares an invoice for one of your company's roadside cases that is not cancelled: its kind, who billed, the invoice number and day (not in the future), and the amount before VAT and the VAT in whole minor units (halalas). The same invoice number cannot be declared twice for the company. A tow invoice is compared with the agreed price as in the panel. No expense of the vehicle is recorded from here; that is done in the panel. A case of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `assistance:case_costs:write`.",
                "summary": "Declare a roadside invoice",
                "tags": [
                    "CostWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/DeclareCostRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "kind": {
                                                "type": "string",
                                                "description": "What the invoice is for: repair, tow or other.",
                                                "examples": [
                                                    "tow"
                                                ]
                                            },
                                            "payee": {
                                                "type": "string",
                                                "description": "Who billed, 2 to 150 characters.",
                                                "examples": [
                                                    "Al Amal Towing"
                                                ]
                                            },
                                            "invoice_number": {
                                                "type": "string",
                                                "description": "The invoice number, up to 60 characters.",
                                                "examples": [
                                                    "INV-2291"
                                                ]
                                            },
                                            "invoice_on": {
                                                "type": "string",
                                                "description": "The invoice day, Y-m-d, not in the future.",
                                                "examples": [
                                                    "2026-06-02"
                                                ]
                                            },
                                            "amount_minor": {
                                                "type": "integer",
                                                "description": "The amount before VAT in whole minor units.",
                                                "examples": [
                                                    45000
                                                ]
                                            },
                                            "vat_minor": {
                                                "type": "integer",
                                                "description": "The VAT in whole minor units, not above the amount; 0 when left out.",
                                                "examples": [
                                                    6750
                                                ]
                                            }
                                        },
                                        "required": [
                                            "kind",
                                            "payee",
                                            "invoice_number",
                                            "invoice_on",
                                            "amount_minor"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The declared invoice.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "7c2e9b40-5d1a-4e8f-a3b6-0f9d2c4e1a55",
                                                "case_uuid": "5b1d7a20-3c4e-4f6a-9d11-8e2a0c7b6f33",
                                                "kind": "tow",
                                                "invoice_on": "2026-06-02",
                                                "amount_minor": 45000,
                                                "vat_minor": 6750,
                                                "total_minor": 51750,
                                                "currency": "SAR",
                                                "retracted": false,
                                                "retracted_at": null,
                                                "declared_at": "2026-06-02T09:30:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uuid": {
                                                    "type": "string"
                                                },
                                                "case_uuid": {
                                                    "type": "string"
                                                },
                                                "kind": {
                                                    "type": "string"
                                                },
                                                "invoice_on": {
                                                    "type": "string"
                                                },
                                                "amount_minor": {
                                                    "type": "integer"
                                                },
                                                "vat_minor": {
                                                    "type": "integer"
                                                },
                                                "total_minor": {
                                                    "type": "integer"
                                                },
                                                "currency": {
                                                    "type": "string"
                                                },
                                                "retracted": {
                                                    "type": "string"
                                                },
                                                "retracted_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "declared_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "uuid",
                                                "case_uuid",
                                                "kind",
                                                "invoice_on",
                                                "amount_minor",
                                                "vat_minor",
                                                "total_minor",
                                                "currency",
                                                "retracted",
                                                "retracted_at",
                                                "declared_at"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "anyOf": [
                                                {
                                                    "type": "object"
                                                },
                                                {
                                                    "$ref": "#/components/schemas/CaseRuleViolation"
                                                }
                                            ]
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/roadside/costs/{uuid}/retract": {
            "post": {
                "operationId": "roadside.costs.retract",
                "description": "Retracts a mistaken invoice of one of your company's roadside cases, with the reason; the line stays in the list marked retracted and an expense of the vehicle recorded in the panel for it is voided with it. An invoice already retracted answers 422. An invoice of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `assistance:case_costs:write`.",
                "summary": "Retract a roadside invoice",
                "tags": [
                    "CostWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/RetractCostRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "reason": {
                                                "type": "string",
                                                "description": "Why the invoice is retracted, plain text up to 500 characters; it is never returned by the read endpoints.",
                                                "examples": [
                                                    "Declared twice by mistake"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "reason"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The invoice after the change.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "7c2e9b40-5d1a-4e8f-a3b6-0f9d2c4e1a55",
                                                "case_uuid": "5b1d7a20-3c4e-4f6a-9d11-8e2a0c7b6f33",
                                                "kind": "tow",
                                                "invoice_on": "2026-06-02",
                                                "amount_minor": 45000,
                                                "vat_minor": 6750,
                                                "total_minor": 51750,
                                                "currency": "SAR",
                                                "retracted": false,
                                                "retracted_at": null,
                                                "declared_at": "2026-06-02T09:30:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "case_uuid": {
                                                            "type": "string"
                                                        },
                                                        "kind": {
                                                            "type": "string"
                                                        },
                                                        "invoice_on": {
                                                            "type": "string"
                                                        },
                                                        "amount_minor": {
                                                            "type": "integer"
                                                        },
                                                        "vat_minor": {
                                                            "type": "integer"
                                                        },
                                                        "total_minor": {
                                                            "type": "integer"
                                                        },
                                                        "currency": {
                                                            "type": "string"
                                                        },
                                                        "retracted": {
                                                            "type": "string"
                                                        },
                                                        "retracted_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "declared_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "case_uuid",
                                                        "kind",
                                                        "invoice_on",
                                                        "amount_minor",
                                                        "vat_minor",
                                                        "total_minor",
                                                        "currency",
                                                        "retracted",
                                                        "retracted_at",
                                                        "declared_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "anyOf": [
                                                {
                                                    "type": "object"
                                                },
                                                {
                                                    "$ref": "#/components/schemas/CaseRuleViolation"
                                                }
                                            ]
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/billing/currencies": {
            "get": {
                "operationId": "billing.currencies",
                "description": "Lists the enabled currencies with the size of their minor unit, so a money amount in minor units can be shown. Requires the key scope `billing:read`; the module is closed (404) until the platform opens it.\n\nRequires the key scope `billing:read`.",
                "summary": "List billing currencies",
                "tags": [
                    "Currency"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The enabled currencies.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "code": "SAR",
                                                    "name_ar": "ريال سعودي",
                                                    "name_en": "Saudi riyal",
                                                    "symbol": "ر.س",
                                                    "minor_unit": 2,
                                                    "price_rounding_minor": 1
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/reports/customer-profit": {
            "get": {
                "operationId": "reports.customer_profit",
                "description": "Lists, for each of your own customers, what its delivered orders earned and what its share of the trips cost in the period: revenue, cost, the margin and its percent of the revenue, and the revenue per ton where orders are weighed. A customer of the market, or one outside your scope, has no uuid. The cost includes the daily allowance of the drivers, so the owner of the key needs the right to see per diem as well as the reports right. Money is a list of lines, one per currency, never added across currencies. The period is whole Saudi days, at most a year; no driver is named.\n\nRequires the key scope `reporting:reports_customer_profit:read`.",
                "summary": "Read the customer profitability report",
                "tags": [
                    "CustomerProfitReport"
                ],
                "parameters": [
                    {
                        "name": "from",
                        "in": "query",
                        "required": true,
                        "description": "Start of the period, ISO 8601 with an offset.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "required": true,
                        "description": "End of the period, after from and at most 366 days later; its Saudi day is included.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "customer",
                        "in": "query",
                        "description": "Only this customer (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "One page of customers; meta.withheld_trips counts trips left out because their orders may not be read.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "customer_uuid": "3f6b1c0e-8d2a-4c57-b1a9-6e0d4f7a2c11",
                                                    "delivered_orders": 40,
                                                    "unpriced_orders": 1,
                                                    "revenue": [
                                                        {
                                                            "currency": "SAR",
                                                            "amount": "120000.00"
                                                        }
                                                    ],
                                                    "cost": [
                                                        {
                                                            "currency": "SAR",
                                                            "amount": "74000.00"
                                                        }
                                                    ],
                                                    "margin": [
                                                        {
                                                            "currency": "SAR",
                                                            "amount": "46000.00"
                                                        }
                                                    ],
                                                    "margin_percent": [
                                                        {
                                                            "currency": "SAR",
                                                            "percent": "38.3"
                                                        }
                                                    ],
                                                    "revenue_per_ton": [
                                                        {
                                                            "currency": "SAR",
                                                            "amount": "310.50"
                                                        }
                                                    ]
                                                }
                                            ],
                                            "meta": {
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                },
                                                "withheld_trips": 0
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": []
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "type": "string"
                                                        },
                                                        "timestamp": {
                                                            "type": "string"
                                                        },
                                                        "page": {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        "timezone": {
                                                            "type": "string"
                                                        },
                                                        "withheld_trips": {
                                                            "type": "integer"
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "page",
                                                        "timezone",
                                                        "withheld_trips"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    },
                                                    "minItems": 0,
                                                    "maxItems": 0
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "page": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "limit": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": "integer"
                                                                                },
                                                                                []
                                                                            ]
                                                                        },
                                                                        "next_cursor": []
                                                                    },
                                                                    "required": [
                                                                        "limit",
                                                                        "next_cursor"
                                                                    ],
                                                                    "additionalProperties": []
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timezone": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "page",
                                                        "timezone"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/defects": {
            "get": {
                "operationId": "defects.index",
                "description": "Lists your company's vehicle defects, oldest first, one page at a time. Each carries the vehicle, a short title (free text as typed), severity, state and times, and the inspection or work order it is tied to; descriptions and resolutions are never shown. A branch-limited key sees only the defects of the vehicles that are currently in its branch.\n\nRequires the key scope `defects:read`.",
                "summary": "List defects",
                "tags": [
                    "Defect"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only defects in this state: open, in_repair, resolved or dismissed.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "open"
                    },
                    {
                        "name": "vehicle",
                        "in": "query",
                        "description": "Only the vehicle defects of this vehicle (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only vehicle defects changed at or after this moment (ISO 8601 with an offset, e.g. 2026-05-01T00:00:00Z).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of vehicle defects.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "9d4f1a63-7b28-4c05-8e1a-6f3b2c9d0e55",
                                                    "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                    "inspection_uuid": "4e2b7c10-9a35-4d68-b1f4-2c8a6e0d5b77",
                                                    "work_order_uuid": null,
                                                    "source": "inspection",
                                                    "title": "Worn front brake pads",
                                                    "severity": "major",
                                                    "category_code": "brake",
                                                    "status": "open",
                                                    "reported_at": "2026-05-12T07:48:00Z",
                                                    "closed_at": null,
                                                    "created_at": "2026-05-12T07:50:12Z",
                                                    "updated_at": "2026-05-12T07:50:12Z",
                                                    "row_version": 3
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "post": {
                "operationId": "defects.report",
                "description": "Reports a defect on one of your company's vehicles, as the panel does, with its notices to the maintenance people: a title, the severity (minor, major or critical) and optionally a description and a maintenance category code. A driver, an inspection or an amount of money is never accepted. At most 10 reports an hour for one vehicle. A vehicle of another company or branch answers 404 exactly like one that does not exist. Requires the key scope `fleet:defects:write` and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:defects:write`.",
                "summary": "Report a defect",
                "tags": [
                    "DefectWrite"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/ReportDefectRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "vehicle": {
                                                "type": "string",
                                                "format": "uuid",
                                                "description": "The vehicle, by its uuid.",
                                                "examples": [
                                                    "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11"
                                                ]
                                            },
                                            "title": {
                                                "type": "string",
                                                "description": "What is wrong, 3 to 200 characters of plain text.",
                                                "examples": [
                                                    "Worn front brake pads"
                                                ]
                                            },
                                            "severity": {
                                                "type": "string",
                                                "description": "minor, major or critical.",
                                                "examples": [
                                                    "major"
                                                ]
                                            },
                                            "description": {
                                                "type": "string",
                                                "description": "More detail, up to 1000 characters of plain text.",
                                                "examples": [
                                                    "Heard grinding when braking"
                                                ]
                                            },
                                            "category": {
                                                "type": "string",
                                                "description": "The code of the maintenance category.",
                                                "examples": [
                                                    "brake"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "vehicle",
                                            "title",
                                            "severity"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The defect that was reported.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "9d4f1a63-7b28-4c05-8e1a-6f3b2c9d0e55",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "inspection_uuid": "4e2b7c10-9a35-4d68-b1f4-2c8a6e0d5b77",
                                                "work_order_uuid": null,
                                                "source": "inspection",
                                                "title": "Worn front brake pads",
                                                "severity": "major",
                                                "category_code": "brake",
                                                "status": "open",
                                                "reported_at": "2026-05-12T07:48:00Z",
                                                "closed_at": null,
                                                "created_at": "2026-05-12T07:50:12Z",
                                                "updated_at": "2026-05-12T07:50:12Z",
                                                "row_version": 3
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uuid": {
                                                    "type": "string"
                                                },
                                                "vehicle_uuid": {
                                                    "type": "string"
                                                },
                                                "inspection_uuid": {
                                                    "type": "string"
                                                },
                                                "work_order_uuid": {
                                                    "type": "string"
                                                },
                                                "source": {
                                                    "type": "string"
                                                },
                                                "title": {
                                                    "type": "string"
                                                },
                                                "severity": {
                                                    "type": "string"
                                                },
                                                "category_code": {
                                                    "type": "string"
                                                },
                                                "status": {
                                                    "type": "string"
                                                },
                                                "reported_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "closed_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "row_version": {
                                                    "type": "integer"
                                                }
                                            },
                                            "required": [
                                                "uuid",
                                                "vehicle_uuid",
                                                "inspection_uuid",
                                                "work_order_uuid",
                                                "source",
                                                "title",
                                                "severity",
                                                "category_code",
                                                "status",
                                                "reported_at",
                                                "closed_at",
                                                "created_at",
                                                "updated_at",
                                                "row_version"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/defects/{uuid}": {
            "get": {
                "operationId": "defects.show",
                "description": "Reads one of your company's vehicle defects by its uuid. A record of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `defects:read`.",
                "summary": "Read a defect",
                "tags": [
                    "Defect"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The defect.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "9d4f1a63-7b28-4c05-8e1a-6f3b2c9d0e55",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "inspection_uuid": "4e2b7c10-9a35-4d68-b1f4-2c8a6e0d5b77",
                                                "work_order_uuid": null,
                                                "source": "inspection",
                                                "title": "Worn front brake pads",
                                                "severity": "major",
                                                "category_code": "brake",
                                                "status": "open",
                                                "reported_at": "2026-05-12T07:48:00Z",
                                                "closed_at": null,
                                                "created_at": "2026-05-12T07:50:12Z",
                                                "updated_at": "2026-05-12T07:50:12Z",
                                                "row_version": 3
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "additionalProperties": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/defects/{uuid}/dismiss": {
            "post": {
                "operationId": "defects.dismiss",
                "description": "Closes a minor or major defect that is not real or needs nothing, as the panel does. A critical defect is safety evidence and is dismissed in the panel only (422). Send the `row_version` you read and the reason; a defect changed meanwhile or no longer open answers 409. Requires the key scope `fleet:defects:write` and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:defects:write`.",
                "summary": "Dismiss a defect",
                "tags": [
                    "DefectWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/DismissDefectRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The version of the defect you read.",
                                                "examples": [
                                                    1
                                                ]
                                            },
                                            "reason": {
                                                "type": "string",
                                                "description": "Why it is dismissed, 3 to 500 characters of plain text.",
                                                "examples": [
                                                    "Reported twice"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version",
                                            "reason"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The defect, now dismissed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "9d4f1a63-7b28-4c05-8e1a-6f3b2c9d0e55",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "inspection_uuid": "4e2b7c10-9a35-4d68-b1f4-2c8a6e0d5b77",
                                                "work_order_uuid": null,
                                                "source": "inspection",
                                                "title": "Worn front brake pads",
                                                "severity": "major",
                                                "category_code": "brake",
                                                "status": "open",
                                                "reported_at": "2026-05-12T07:48:00Z",
                                                "closed_at": null,
                                                "created_at": "2026-05-12T07:50:12Z",
                                                "updated_at": "2026-05-12T07:50:12Z",
                                                "row_version": 3
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "vehicle_uuid": {
                                                            "type": "string"
                                                        },
                                                        "inspection_uuid": {
                                                            "type": "string"
                                                        },
                                                        "work_order_uuid": {
                                                            "type": "string"
                                                        },
                                                        "source": {
                                                            "type": "string"
                                                        },
                                                        "title": {
                                                            "type": "string"
                                                        },
                                                        "severity": {
                                                            "type": "string"
                                                        },
                                                        "category_code": {
                                                            "type": "string"
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "reported_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "closed_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "row_version": {
                                                            "type": "integer"
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "vehicle_uuid",
                                                        "inspection_uuid",
                                                        "work_order_uuid",
                                                        "source",
                                                        "title",
                                                        "severity",
                                                        "category_code",
                                                        "status",
                                                        "reported_at",
                                                        "closed_at",
                                                        "created_at",
                                                        "updated_at",
                                                        "row_version"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/vehicles/{uuid}/depreciation": {
            "get": {
                "operationId": "vehicles.depreciation",
                "description": "The running depreciation plan of one of your vehicles and its book value today; null when it has no running plan. Needs the finance right (403 without it); a vehicle of another company or branch answers 404.\n\nRequires the key scope `depreciation:read`.",
                "summary": "Read a vehicle's depreciation",
                "tags": [
                    "Depreciation"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The plan.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "plan": {
                                                    "method": "straight_line",
                                                    "acquisition_cost_minor": 1250050,
                                                    "salvage_minor": 125000,
                                                    "currency": "SAR",
                                                    "acquired_on": "2026-01-01",
                                                    "life_months": 60,
                                                    "accumulated_minor": 150000,
                                                    "book_value_minor": 1100050,
                                                    "is_fully_depreciated": false
                                                }
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-14T12:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "plan": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "method": {
                                                            "type": "string"
                                                        },
                                                        "acquisition_cost_minor": {
                                                            "type": "integer"
                                                        },
                                                        "salvage_minor": {
                                                            "type": "integer"
                                                        },
                                                        "currency": {
                                                            "type": "string"
                                                        },
                                                        "acquired_on": {
                                                            "type": "string"
                                                        },
                                                        "life_months": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ]
                                                        },
                                                        "accumulated_minor": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ]
                                                        },
                                                        "book_value_minor": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ]
                                                        },
                                                        "is_fully_depreciated": {
                                                            "type": [
                                                                "boolean",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "method",
                                                        "acquisition_cost_minor",
                                                        "salvage_minor",
                                                        "currency",
                                                        "acquired_on",
                                                        "life_months",
                                                        "accumulated_minor",
                                                        "book_value_minor",
                                                        "is_fully_depreciated"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "plan"
                                            ],
                                            "additionalProperties": {
                                                "type": "string"
                                            }
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "post": {
                "operationId": "vehicles.depreciation.set",
                "description": "Sets the depreciation plan of one of your vehicles as the vehicle page does, with the same rights and rules. When a plan is running, send replace_reason: it ends that plan and the new one starts. Needs the finance right and the Idempotency-Key header.\n\nRequires the key scope `fleet:depreciation:write`.",
                "summary": "Set a vehicle's depreciation plan",
                "tags": [
                    "DepreciationWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/SetDepreciationPlanRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "method": {
                                                "type": "string",
                                                "description": "straight_line, declining_balance or per_km.",
                                                "examples": [
                                                    "straight_line"
                                                ]
                                            },
                                            "cost": {
                                                "type": "string",
                                                "description": "The purchase cost as a decimal in the currency's major unit; Arabic digits are accepted.",
                                                "examples": [
                                                    "125000.50"
                                                ]
                                            },
                                            "salvage": {
                                                "type": "string",
                                                "description": "The value left at the end; 0 when absent.",
                                                "examples": [
                                                    "12500"
                                                ]
                                            },
                                            "currency": {
                                                "type": "string",
                                                "description": "A three-letter code of an enabled currency; the platform's default when absent.",
                                                "examples": [
                                                    "SAR"
                                                ]
                                            },
                                            "acquired_on": {
                                                "type": "string",
                                                "format": "date",
                                                "description": "The day of purchase, YYYY-MM-DD, not in the future.",
                                                "examples": [
                                                    "2026-01-01"
                                                ]
                                            },
                                            "life_months": {
                                                "type": "integer",
                                                "description": "Straight line: the life in months.",
                                                "examples": [
                                                    60
                                                ]
                                            },
                                            "rate_percent": {
                                                "type": "string",
                                                "description": "Declining balance: the yearly rate in percent.",
                                                "examples": [
                                                    "20"
                                                ]
                                            },
                                            "total_km": {
                                                "type": "integer",
                                                "description": "Per distance: the total kilometres of the life.",
                                                "examples": [
                                                    500000
                                                ]
                                            },
                                            "start_km": {
                                                "type": "integer",
                                                "description": "Per distance: the odometer at the start.",
                                                "examples": [
                                                    0
                                                ]
                                            },
                                            "replace_reason": {
                                                "type": "string",
                                                "description": "Why the running plan ends; required while one is running.",
                                                "examples": [
                                                    "Corrected cost"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "method",
                                            "cost",
                                            "acquired_on"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The plan that was set.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "method": "straight_line",
                                                "acquisition_cost_minor": 12500050,
                                                "salvage_minor": 1250000,
                                                "currency": "SAR",
                                                "acquired_on": "2026-01-01",
                                                "life_months": 60,
                                                "version": 1,
                                                "ended": false
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-14T12:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "method": {
                                                    "type": "string"
                                                },
                                                "acquisition_cost_minor": {
                                                    "type": "integer"
                                                },
                                                "salvage_minor": {
                                                    "type": "integer"
                                                },
                                                "currency": {
                                                    "type": "string"
                                                },
                                                "acquired_on": {
                                                    "type": "string"
                                                },
                                                "life_months": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "version": {
                                                    "type": "integer"
                                                },
                                                "ended": {
                                                    "type": "boolean"
                                                }
                                            },
                                            "required": [
                                                "method",
                                                "acquisition_cost_minor",
                                                "salvage_minor",
                                                "currency",
                                                "acquired_on",
                                                "life_months",
                                                "version",
                                                "ended"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/fleet-assets/{uuid}/depreciation": {
            "get": {
                "operationId": "fleet_assets.depreciation",
                "description": "The running depreciation plan of one of your trailers or pieces of equipment and its book value today; null when it has no running plan. Needs the finance right (403 without it); an asset of another company or branch answers 404.\n\nRequires the key scope `depreciation:read`.",
                "summary": "Read a fleet asset's depreciation",
                "tags": [
                    "Depreciation"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The plan.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "asset_uuid": "9e2b7c14-3d58-4f0a-b6a1-7c4d2e8f5a10",
                                                "plan": {
                                                    "method": "straight_line",
                                                    "acquisition_cost_minor": 1250050,
                                                    "salvage_minor": 125000,
                                                    "currency": "SAR",
                                                    "acquired_on": "2026-01-01",
                                                    "life_months": 60,
                                                    "accumulated_minor": 150000,
                                                    "book_value_minor": 1100050,
                                                    "is_fully_depreciated": false
                                                }
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-14T12:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "plan": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "method": {
                                                            "type": "string"
                                                        },
                                                        "acquisition_cost_minor": {
                                                            "type": "integer"
                                                        },
                                                        "salvage_minor": {
                                                            "type": "integer"
                                                        },
                                                        "currency": {
                                                            "type": "string"
                                                        },
                                                        "acquired_on": {
                                                            "type": "string"
                                                        },
                                                        "life_months": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ]
                                                        },
                                                        "accumulated_minor": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ]
                                                        },
                                                        "book_value_minor": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ]
                                                        },
                                                        "is_fully_depreciated": {
                                                            "type": [
                                                                "boolean",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "method",
                                                        "acquisition_cost_minor",
                                                        "salvage_minor",
                                                        "currency",
                                                        "acquired_on",
                                                        "life_months",
                                                        "accumulated_minor",
                                                        "book_value_minor",
                                                        "is_fully_depreciated"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "plan"
                                            ],
                                            "additionalProperties": {
                                                "type": "string"
                                            }
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "post": {
                "operationId": "fleet_assets.depreciation.set",
                "description": "Sets the depreciation plan of one of your trailers or pieces of equipment as its page does, with the same rights and rules; per_km is for vehicles only. When a plan is running, send replace_reason. Needs the finance right and the Idempotency-Key header.\n\nRequires the key scope `fleet:depreciation:write`.",
                "summary": "Set a fleet asset's depreciation plan",
                "tags": [
                    "DepreciationWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/SetDepreciationPlanRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "method": {
                                                "type": "string",
                                                "description": "straight_line or declining_balance.",
                                                "examples": [
                                                    "straight_line"
                                                ]
                                            },
                                            "cost": {
                                                "type": "string",
                                                "description": "The purchase cost as a decimal in the currency's major unit.",
                                                "examples": [
                                                    "85000"
                                                ]
                                            },
                                            "acquired_on": {
                                                "type": "string",
                                                "format": "date",
                                                "description": "The day of purchase, YYYY-MM-DD, not in the future.",
                                                "examples": [
                                                    "2026-01-01"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "method",
                                            "cost",
                                            "acquired_on"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The plan that was set.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "method": "straight_line",
                                                "acquisition_cost_minor": 8500000,
                                                "salvage_minor": 0,
                                                "currency": "SAR",
                                                "acquired_on": "2026-01-01",
                                                "life_months": 60,
                                                "version": 1,
                                                "ended": false
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-14T12:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "method": {
                                                    "type": "string"
                                                },
                                                "acquisition_cost_minor": {
                                                    "type": "integer"
                                                },
                                                "salvage_minor": {
                                                    "type": "integer"
                                                },
                                                "currency": {
                                                    "type": "string"
                                                },
                                                "acquired_on": {
                                                    "type": "string"
                                                },
                                                "life_months": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "version": {
                                                    "type": "integer"
                                                },
                                                "ended": {
                                                    "type": "boolean"
                                                }
                                            },
                                            "required": [
                                                "method",
                                                "acquisition_cost_minor",
                                                "salvage_minor",
                                                "currency",
                                                "acquired_on",
                                                "life_months",
                                                "version",
                                                "ended"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/vehicles/{uuid}/depreciation/end": {
            "post": {
                "operationId": "vehicles.depreciation.end",
                "description": "Ends the running plan of one of your vehicles with the version you read and a written reason. The plan stays in the history. Needs the finance right and the Idempotency-Key header.\n\nRequires the key scope `fleet:depreciation:write`.",
                "summary": "End the running depreciation plan",
                "tags": [
                    "DepreciationWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/VoidLifecycleStageRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "version": {
                                                "type": "integer",
                                                "description": "The version of the plan you read; a stale one is refused.",
                                                "examples": [
                                                    1
                                                ]
                                            },
                                            "reason": {
                                                "type": "string",
                                                "description": "Why, at least ten characters.",
                                                "examples": [
                                                    "Vehicle moved to another owner"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "version",
                                            "reason"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The plan after it ended.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "method": "straight_line",
                                                "acquisition_cost_minor": 12500050,
                                                "salvage_minor": 1250000,
                                                "currency": "SAR",
                                                "acquired_on": "2026-01-01",
                                                "life_months": 60,
                                                "version": 2,
                                                "ended": true
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-14T12:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "method": {
                                                            "type": "string"
                                                        },
                                                        "acquisition_cost_minor": {
                                                            "type": "integer"
                                                        },
                                                        "salvage_minor": {
                                                            "type": "integer"
                                                        },
                                                        "currency": {
                                                            "type": "string"
                                                        },
                                                        "acquired_on": {
                                                            "type": "string"
                                                        },
                                                        "life_months": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ]
                                                        },
                                                        "version": {
                                                            "type": "integer"
                                                        },
                                                        "ended": {
                                                            "type": "boolean"
                                                        }
                                                    },
                                                    "required": [
                                                        "method",
                                                        "acquisition_cost_minor",
                                                        "salvage_minor",
                                                        "currency",
                                                        "acquired_on",
                                                        "life_months",
                                                        "version",
                                                        "ended"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/fleet-assets/{uuid}/depreciation/end": {
            "post": {
                "operationId": "fleet_assets.depreciation.end",
                "description": "Ends the running plan of one of your trailers or pieces of equipment with the version you read and a written reason. The plan stays in the history. Needs the finance right and the Idempotency-Key header.\n\nRequires the key scope `fleet:depreciation:write`.",
                "summary": "End a fleet asset's running depreciation plan",
                "tags": [
                    "DepreciationWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/VoidLifecycleStageRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "version": {
                                                "type": "integer",
                                                "description": "The version of the plan you read; a stale one is refused.",
                                                "examples": [
                                                    1
                                                ]
                                            },
                                            "reason": {
                                                "type": "string",
                                                "description": "Why, at least ten characters.",
                                                "examples": [
                                                    "Asset moved to another owner"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "version",
                                            "reason"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The plan after it ended.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "method": "straight_line",
                                                "acquisition_cost_minor": 8500000,
                                                "salvage_minor": 0,
                                                "currency": "SAR",
                                                "acquired_on": "2026-01-01",
                                                "life_months": 60,
                                                "version": 2,
                                                "ended": true
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-14T12:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "method": {
                                                            "type": "string"
                                                        },
                                                        "acquisition_cost_minor": {
                                                            "type": "integer"
                                                        },
                                                        "salvage_minor": {
                                                            "type": "integer"
                                                        },
                                                        "currency": {
                                                            "type": "string"
                                                        },
                                                        "acquired_on": {
                                                            "type": "string"
                                                        },
                                                        "life_months": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ]
                                                        },
                                                        "version": {
                                                            "type": "integer"
                                                        },
                                                        "ended": {
                                                            "type": "boolean"
                                                        }
                                                    },
                                                    "required": [
                                                        "method",
                                                        "acquisition_cost_minor",
                                                        "salvage_minor",
                                                        "currency",
                                                        "acquired_on",
                                                        "life_months",
                                                        "version",
                                                        "ended"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/devices": {
            "get": {
                "operationId": "devices.index",
                "description": "Lists your company's tracking devices, oldest first, one page at a time. Archived devices are left out unless you ask for status=archived. A branch-limited key sees only its own branch (records shared with your branch are included; their branch_uuid is empty). vehicle_uuid is the vehicle the device is installed in now. SIM numbers are never returned. Times are UTC; meta.timezone names the platform time zone; the two expiry fields are calendar days.\n\nRequires the key scope `devices:read`.",
                "summary": "List devices",
                "tags": [
                    "Device"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only devices in this state.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "active"
                    },
                    {
                        "name": "branch",
                        "in": "query",
                        "description": "Only devices of this branch (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only devices changed at or after this moment (ISO 8601 with an offset, e.g. 2026-05-01T00:00:00Z).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of devices.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "9e2b4d61-3f58-4c7a-b1d9-2a6c8e0f3b55",
                                                    "status": "active",
                                                    "imei": "356307042441013",
                                                    "device_brand": "Teltonika",
                                                    "device_model": "FMC130",
                                                    "serial_number": "SN-2201987",
                                                    "telecom_company_name": "STC",
                                                    "sim_expires_on": "2027-01-31",
                                                    "warranty_expires_on": "2027-06-30",
                                                    "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                    "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                    "installed_on": "2026-03-02",
                                                    "installations": [
                                                        {
                                                            "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                            "installed_on": "2026-03-02",
                                                            "removed_on": null
                                                        },
                                                        {
                                                            "vehicle_uuid": "7c2e9a14-1b5d-4f60-8e3a-6d4b2f9c0e77",
                                                            "installed_on": "2025-11-10",
                                                            "removed_on": "2026-03-01"
                                                        }
                                                    ],
                                                    "archived_at": null,
                                                    "created_at": "2026-03-01T08:30:00Z",
                                                    "updated_at": "2026-05-12T11:05:42Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/devices/{uuid}": {
            "get": {
                "operationId": "devices.show",
                "description": "Reads one of your company's tracking devices by its uuid. A device of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `devices:read`.",
                "summary": "Read a device",
                "tags": [
                    "Device"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The device.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "9e2b4d61-3f58-4c7a-b1d9-2a6c8e0f3b55",
                                                "status": "active",
                                                "imei": "356307042441013",
                                                "device_brand": "Teltonika",
                                                "device_model": "FMC130",
                                                "serial_number": "SN-2201987",
                                                "telecom_company_name": "STC",
                                                "sim_expires_on": "2027-01-31",
                                                "warranty_expires_on": "2027-06-30",
                                                "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "installed_on": "2026-03-02",
                                                "installations": [
                                                    {
                                                        "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                        "installed_on": "2026-03-02",
                                                        "removed_on": null
                                                    },
                                                    {
                                                        "vehicle_uuid": "7c2e9a14-1b5d-4f60-8e3a-6d4b2f9c0e77",
                                                        "installed_on": "2025-11-10",
                                                        "removed_on": "2026-03-01"
                                                    }
                                                ],
                                                "archived_at": null,
                                                "created_at": "2026-03-01T08:30:00Z",
                                                "updated_at": "2026-05-12T11:05:42Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "additionalProperties": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/device-commands": {
            "get": {
                "operationId": "device_commands.index",
                "description": "Lists the latest commands sent to your devices, newest first, at most 100: the command name, how it was sent, its outcome, whether it is critical and when. Command values, device numbers and who sent it are never returned. You see the commands your key's owner sent; a company administrator sees all of the company's.\n\nRequires the key scope `device_command_log:read`.",
                "summary": "List recent device commands",
                "tags": [
                    "DeviceCommandLog"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The latest commands.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "8e3a5b17-2d64-4c90-a1f8-5b7c0d9e4a26",
                                                    "device_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                    "command": "Request position",
                                                    "channel": "gprs",
                                                    "outcome": "accepted",
                                                    "critical": false,
                                                    "sent_at": "2026-11-14T08:30:00Z",
                                                    "finished_at": "2026-11-14T08:30:02Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-14T12:00:00Z",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "additionalProperties": {
                                                "type": "object",
                                                "properties": {
                                                    "uuid": {
                                                        "type": "string"
                                                    },
                                                    "device_uuid": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "command": {
                                                        "type": "string"
                                                    },
                                                    "channel": {
                                                        "type": "string"
                                                    },
                                                    "outcome": {
                                                        "type": "string"
                                                    },
                                                    "critical": {
                                                        "type": "boolean"
                                                    },
                                                    "sent_at": {
                                                        "type": "string"
                                                    },
                                                    "finished_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    }
                                                },
                                                "required": [
                                                    "uuid",
                                                    "device_uuid",
                                                    "command",
                                                    "channel",
                                                    "outcome",
                                                    "critical",
                                                    "sent_at",
                                                    "finished_at"
                                                ]
                                            }
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": []
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/vehicles/{uuid}/disposal": {
            "post": {
                "operationId": "vehicles.disposal.store",
                "description": "Records that one of your vehicles was sold or scrapped, as the vehicle page does, with the same rights and rules: the depreciation plan ends on that day, the gain or loss is worked out by the server, the vehicle leaves the live lists and its integrations are cut. Send the price; name the buyer by `buyer_uuid` (a buyer you keep) or by `buyer_name`; an identity number is refused anywhere. The contract is attached in the panel. Needs the finance right over the whole company, the Idempotency-Key header, and stays within 10 an hour per key and 100 a day per company. Your finance holders are told, naming the key.\n\nRequires the key scope `fleet:disposal:write`.",
                "summary": "Record a vehicle sale or scrapping",
                "tags": [
                    "DisposalWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/DisposeVehicleRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "kind": {
                                                "type": "string",
                                                "description": "sale or scrap.",
                                                "examples": [
                                                    "sale"
                                                ]
                                            },
                                            "occurred_on": {
                                                "type": "string",
                                                "format": "date",
                                                "description": "The day, YYYY-MM-DD, not in the future.",
                                                "examples": [
                                                    "2026-06-01"
                                                ]
                                            },
                                            "amount": {
                                                "type": "string",
                                                "description": "The price (or the scrap value) as a decimal in the currency's major unit, above zero; Arabic digits are accepted.",
                                                "examples": [
                                                    "52000.00"
                                                ]
                                            },
                                            "currency": {
                                                "type": "string",
                                                "description": "A three-letter code of an enabled currency; the plan's when absent.",
                                                "examples": [
                                                    "SAR"
                                                ]
                                            },
                                            "buyer_uuid": {
                                                "type": "string",
                                                "format": "uuid",
                                                "description": "A buyer your company keeps; not with buyer_name."
                                            },
                                            "buyer_name": {
                                                "type": "string",
                                                "description": "The buyer's name when no kept buyer is named; a sale needs one or the other.",
                                                "examples": [
                                                    "Example Trading Co"
                                                ]
                                            },
                                            "reference": {
                                                "type": "string",
                                                "description": "The invoice or contract number.",
                                                "examples": [
                                                    "INV-2026-88"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "kind",
                                            "occurred_on",
                                            "amount"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "201": {
                        "description": "The disposal that was recorded.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "kind": "sale",
                                                "occurred_on": "2026-06-01",
                                                "amount_minor": 5200000,
                                                "currency": "SAR",
                                                "version": 1,
                                                "voided": false
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-14T12:00:00Z"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/vehicles/{uuid}/disposal/void": {
            "post": {
                "operationId": "vehicles.disposal.void",
                "description": "Cancels the vehicle's last stage when it is a sale or scrapping, with the version you read and a written reason of at least ten characters: the vehicle returns to operation and its depreciation plan restarts. A second person is needed: the key that recorded the disposal cannot cancel it (422). Needs the Idempotency-Key header and counts in the same caps. Your finance holders are told, naming the key.\n\nRequires the key scope `fleet:disposal:write`.",
                "summary": "Cancel a vehicle sale or scrapping",
                "tags": [
                    "DisposalWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/VoidLifecycleStageRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "version": {
                                                "type": "integer",
                                                "description": "The version of the stage you read; a stale one is refused.",
                                                "examples": [
                                                    1
                                                ]
                                            },
                                            "reason": {
                                                "type": "string",
                                                "description": "Why, at least ten characters.",
                                                "examples": [
                                                    "The buyer withdrew before payment"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "version",
                                            "reason"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The disposal after it was cancelled.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "kind": "sale",
                                                "occurred_on": "2026-06-01",
                                                "amount_minor": 5200000,
                                                "currency": "SAR",
                                                "version": 2,
                                                "voided": true
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-14T12:00:00Z"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/documents": {
            "get": {
                "operationId": "documents.index",
                "description": "Lists the details of the documents your company may read, oldest first, one page at a time: title (free text as typed), class, sensitivity, verification status, file type and size and dates. The file itself, any link to it, its file name and who uploaded it are never shown, and highly confidential documents are never listed. Archived documents are left out. A branch-limited key sees only its own branch.\n\nRequires the key scope `documents:read`.",
                "summary": "List document details",
                "tags": [
                    "Document"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only documents with this verification status: uploaded_unverified, verified or rejected.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "verified"
                    },
                    {
                        "name": "branch",
                        "in": "query",
                        "description": "Only documents of this branch (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only documents changed at or after this moment (ISO 8601 with an offset, e.g. 2026-05-01T00:00:00Z).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of document details.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "1c9f4e82-7a35-4b60-8d12-5e3b0a7c9f46",
                                                    "doc_class": "company_file",
                                                    "title": "Lease contract",
                                                    "sensitivity": "internal",
                                                    "verification_status": "verified",
                                                    "verified_at": "2026-04-20T09:15:00Z",
                                                    "mime_type": "application/pdf",
                                                    "size_bytes": 184320,
                                                    "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                    "created_at": "2026-04-19T11:00:00Z",
                                                    "updated_at": "2026-04-20T09:15:00Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/documents/{uuid}": {
            "get": {
                "operationId": "documents.show",
                "description": "Reads the details of one document by its uuid. A document your company may not read, one of another company or branch, and an unknown one all answer 404.\n\nRequires the key scope `documents:read`.",
                "summary": "Read document details",
                "tags": [
                    "Document"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The document details.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "1c9f4e82-7a35-4b60-8d12-5e3b0a7c9f46",
                                                "doc_class": "company_file",
                                                "title": "Lease contract",
                                                "sensitivity": "internal",
                                                "verification_status": "verified",
                                                "verified_at": "2026-04-20T09:15:00Z",
                                                "mime_type": "application/pdf",
                                                "size_bytes": 184320,
                                                "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                "created_at": "2026-04-19T11:00:00Z",
                                                "updated_at": "2026-04-20T09:15:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "additionalProperties": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/drivers": {
            "get": {
                "operationId": "drivers.index",
                "description": "Lists your company's drivers, oldest first, one page at a time. Archived drivers are left out unless you ask for status=archived. A branch-limited key sees only its own branch (records shared with your branch are included; their branch_uuid is empty). Identity numbers, birth dates and e-mail are never returned. Times are UTC; meta.timezone names the platform time zone.\n\nRequires the key scope `drivers:read`.",
                "summary": "List drivers",
                "tags": [
                    "Driver"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only drivers in this state.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "active"
                    },
                    {
                        "name": "branch",
                        "in": "query",
                        "description": "Only drivers of this branch (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only drivers changed at or after this moment (ISO 8601 with an offset, e.g. 2026-05-01T00:00:00Z).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of drivers.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "3c1e9a52-8d47-4b6a-a2f0-5e7d9b4c1a44",
                                                    "status": "active",
                                                    "full_name": {
                                                        "ar": "أحمد محمد",
                                                        "en": "Ahmed Mohammed"
                                                    },
                                                    "mobile_number": "+966500000000",
                                                    "nationality_country_code": "SA",
                                                    "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                    "employer_operator_uuid": "7a9c3d2e-1b44-4a6f-9c5d-6e8f0a1b2c33",
                                                    "individual_operator_uuid": null,
                                                    "readiness": {
                                                        "state": "not_ready",
                                                        "complete": true,
                                                        "reasons": [
                                                            {
                                                                "code": "licence_expired",
                                                                "date": "2026-05-01"
                                                            }
                                                        ]
                                                    },
                                                    "archived_at": null,
                                                    "created_at": "2026-03-01T08:30:00Z",
                                                    "updated_at": "2026-05-12T11:05:42Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/drivers/{uuid}": {
            "get": {
                "operationId": "drivers.show",
                "description": "Reads one of your company's drivers by its uuid. A driver of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `drivers:read`.",
                "summary": "Read a driver",
                "tags": [
                    "Driver"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The driver.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "3c1e9a52-8d47-4b6a-a2f0-5e7d9b4c1a44",
                                                "status": "active",
                                                "full_name": {
                                                    "ar": "أحمد محمد",
                                                    "en": "Ahmed Mohammed"
                                                },
                                                "mobile_number": "+966500000000",
                                                "nationality_country_code": "SA",
                                                "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                "employer_operator_uuid": "7a9c3d2e-1b44-4a6f-9c5d-6e8f0a1b2c33",
                                                "individual_operator_uuid": null,
                                                "readiness": {
                                                    "state": "not_ready",
                                                    "complete": true,
                                                    "reasons": [
                                                        {
                                                            "code": "licence_expired",
                                                            "date": "2026-05-01"
                                                        }
                                                    ]
                                                },
                                                "archived_at": null,
                                                "created_at": "2026-03-01T08:30:00Z",
                                                "updated_at": "2026-05-12T11:05:42Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "additionalProperties": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "patch": {
                "operationId": "drivers.update",
                "description": "Changes the name and the notes of one of your company's drivers, as the panel does. Send the `row_version` you read: a driver changed meanwhile, or a body without it, answers 409. A part you send replaces that part whole (`full_name` needs at least one language), a part you leave out stays as it is, and `notes` set to null clears the notes. The identity number and type, the border number, the gender, the mobile, the e-mail, the licence numbers, the date of birth, the nationality, the photo, the branch and the status cannot be sent (422 naming the key); they stay in the panel. The answer is the driver as the register reads it, without the mobile. Retry safely with the same Idempotency-Key. At most 60 changes an hour for one key and 600 a day for one company.\n\nRequires the key scope `fleet:drivers:write`.",
                "summary": "Change a driver",
                "tags": [
                    "DriverWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/UpdateDriverRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The version of the driver you read.",
                                                "examples": [
                                                    3
                                                ]
                                            },
                                            "full_name": {
                                                "type": "object",
                                                "description": "The name in Arabic and English, plain text up to 150 characters each; at least one.",
                                                "examples": [
                                                    {
                                                        "ar": "أحمد محمد",
                                                        "en": "Ahmed Mohammed"
                                                    }
                                                ]
                                            },
                                            "notes": {
                                                "type": "object",
                                                "description": "Notes in Arabic and English, plain text up to 1000 characters each; null clears them.",
                                                "examples": [
                                                    {
                                                        "ar": "يقود صهاريج فقط",
                                                        "en": "Drives tankers only"
                                                    }
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The driver after the change.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "3c1e9a52-8d47-4b6a-a2f0-5e7d9b4c1a44",
                                                "status": "active",
                                                "full_name": {
                                                    "ar": "أحمد محمد",
                                                    "en": "Ahmed Mohammed"
                                                },
                                                "mobile_number": "+966500000000",
                                                "nationality_country_code": "SA",
                                                "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                "employer_operator_uuid": "7a9c3d2e-1b44-4a6f-9c5d-6e8f0a1b2c33",
                                                "individual_operator_uuid": null,
                                                "readiness": {
                                                    "state": "not_ready",
                                                    "complete": true,
                                                    "reasons": [
                                                        {
                                                            "code": "licence_expired",
                                                            "date": "2026-05-01"
                                                        }
                                                    ]
                                                },
                                                "archived_at": null,
                                                "created_at": "2026-03-01T08:30:00Z",
                                                "updated_at": "2026-05-12T11:05:42Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": []
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/driver-availability": {
            "get": {
                "operationId": "driver_availability.show",
                "description": "The week of the company's drivers as the availability page shows it: each driver's state on each of seven days (ready, ready without a vehicle, on a trip, on leave, on a rest day of the driver's roster, off duty, not allowed to drive), the day's count of each state, whether the drivers cover each day's planned trips, the cards worth a look (the first short day, the licences ending within 14 days, the trips with no driver) with their counts, and who does not drive on the first day and why. A leave's kind and the reason a driver may not drive appear only for a key owner who may read them, and what the owner may not check is flagged unchecked. A rest day (`rest_day`) is reported, in the days and in the counts, only for a key that also holds the scope `fleet:driver_shifts:read` whose owner may read the roster; otherwise no day is a rest day and the counts carry no `rest_day` entry. Drivers are named by uuid only; no name, phone or position is returned. Requires the key scope `logistics:driver_availability:read` and the dispatch right.\n\nRequires the key scope `logistics:driver_availability:read`.",
                "summary": "Read the driver availability board",
                "tags": [
                    "DriverAvailability"
                ],
                "parameters": [
                    {
                        "name": "day",
                        "in": "query",
                        "description": "The first of the seven days, Y-m-d, from today to a month ahead; today when absent or outside that.",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The board of the week.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "first_day": "2026-11-19",
                                                "days": [
                                                    {
                                                        "date": "2026-11-19",
                                                        "today": true
                                                    }
                                                ],
                                                "total": 12,
                                                "capped": false,
                                                "trips_capped": false,
                                                "partial": false,
                                                "counts": {
                                                    "ready": 5,
                                                    "ready_no_vehicle": 1,
                                                    "trip": 3,
                                                    "leave": 1,
                                                    "rest_day": 0,
                                                    "off_duty": 1,
                                                    "blocked": 1
                                                },
                                                "coverage": [
                                                    {
                                                        "date": "2026-11-19",
                                                        "available": 10,
                                                        "planned": 4,
                                                        "short": false
                                                    }
                                                ],
                                                "drivers": [
                                                    {
                                                        "driver_uuid": "3c1e9a52-8d47-4b6a-a2f0-5e7d9b4c1a44",
                                                        "days": [
                                                            {
                                                                "date": "2026-11-19",
                                                                "state": "ready",
                                                                "label": null,
                                                                "unchecked": false
                                                            }
                                                        ]
                                                    }
                                                ],
                                                "cards": [
                                                    {
                                                        "key": "enough",
                                                        "tone": "good",
                                                        "count": null
                                                    }
                                                ],
                                                "not_driving": [
                                                    {
                                                        "driver_uuid": "3c1e9a52-8d47-4b6a-a2f0-5e7d9b4c1a44",
                                                        "kind": "blocked",
                                                        "topic": "licence"
                                                    }
                                                ]
                                            },
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-19T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "first_day": {
                                                    "type": "string"
                                                },
                                                "days": {
                                                    "type": "array",
                                                    "items": []
                                                },
                                                "total": {
                                                    "type": "integer"
                                                },
                                                "capped": {
                                                    "type": "boolean"
                                                },
                                                "trips_capped": {
                                                    "type": "boolean"
                                                },
                                                "partial": {
                                                    "type": "boolean"
                                                },
                                                "counts": {
                                                    "type": "array",
                                                    "description": "Not asked is not zero: no rest_day count without a roster read (D447).",
                                                    "items": []
                                                },
                                                "coverage": {
                                                    "type": "string"
                                                },
                                                "drivers": {
                                                    "type": "array",
                                                    "items": []
                                                },
                                                "cards": {
                                                    "type": "array",
                                                    "items": []
                                                },
                                                "not_driving": {
                                                    "type": "array",
                                                    "items": []
                                                }
                                            },
                                            "required": [
                                                "first_day",
                                                "days",
                                                "total",
                                                "capped",
                                                "trips_capped",
                                                "partial",
                                                "counts",
                                                "coverage",
                                                "drivers",
                                                "cards",
                                                "not_driving"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/drivers/{uuid}/documents": {
            "get": {
                "operationId": "drivers.documents.index",
                "description": "Lists the files of the kind `other` attached to one of your company's drivers, newest first, up to 200: the document's uuid, its kind, its state (`available` once the scan is clean, otherwise `pending`), type, size and day. It gives the metadata only, never the file, a link, its title or its name; the identity copy is never listed. A driver of another company or branch answers 404 exactly like one that does not exist. Requires the key scope `fleet:driver_documents:write`.\n\nRequires the key scope `fleet:driver_documents:write`.",
                "summary": "List the files of a driver",
                "tags": [
                    "DriverDocument"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The files of the driver.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "5e8f1a22-3b4c-4d6e-8a9b-0c1d2e3f4a55",
                                                    "kind": "other",
                                                    "state": "available",
                                                    "mime_type": "application/pdf",
                                                    "size_bytes": 184320,
                                                    "created_at": "2026-06-01T09:00:00Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 200,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "uuid": {
                                                                "type": "string"
                                                            },
                                                            "kind": {
                                                                "type": "string"
                                                            },
                                                            "state": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "available",
                                                                    "pending"
                                                                ]
                                                            },
                                                            "mime_type": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "size_bytes": {
                                                                "type": [
                                                                    "integer",
                                                                    "null"
                                                                ]
                                                            },
                                                            "created_at": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            }
                                                        },
                                                        "required": [
                                                            "uuid",
                                                            "kind",
                                                            "state",
                                                            "mime_type",
                                                            "size_bytes",
                                                            "created_at"
                                                        ]
                                                    }
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "page": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "limit": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": "integer",
                                                                                    "const": 200
                                                                                },
                                                                                []
                                                                            ]
                                                                        },
                                                                        "next_cursor": []
                                                                    },
                                                                    "required": [
                                                                        "limit",
                                                                        "next_cursor"
                                                                    ],
                                                                    "additionalProperties": []
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timezone": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "page",
                                                        "timezone"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "post": {
                "operationId": "drivers.documents.store",
                "description": "Attaches a PDF, JPEG or PNG to one of your company's drivers as a driver document, as the panel does. Only the kind `other` is accepted: the identity copy stays in the panel. The file is scanned before it is stored and an infected file or a scanner outage is refused (422), so the answer carries the document in its `state`, `available`; there is nothing to poll. The file is not verified by this and changes nothing about the driver's readiness. The name you send is not kept. A company may upload a limited number of bytes a day, and a key a limited number of files an hour, through the API (429 with the reason `daily_quota` or `hourly_uploads`). A driver of another company or branch answers 404. Requires the key scope `fleet:driver_documents:write`, its owner's right to attach documents and to view the driver, and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:driver_documents:write`.",
                "summary": "Attach a document to a driver",
                "tags": [
                    "DriverDocumentWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/UploadDriverDocumentRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "file": {
                                                "type": "string",
                                                "format": "binary",
                                                "description": "The file, sent as multipart form data."
                                            },
                                            "kind": {
                                                "type": "string",
                                                "description": "other.",
                                                "examples": [
                                                    "other"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "file",
                                            "kind"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The attached document; state is available once the scan is clean, otherwise pending.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "5e8f1a22-3b4c-4d6e-8a9b-0c1d2e3f4a55",
                                                "kind": "other",
                                                "state": "available",
                                                "mime_type": "application/pdf",
                                                "size_bytes": 184320,
                                                "created_at": "2026-06-01T09:00:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uuid": {
                                                    "type": "string"
                                                },
                                                "kind": {
                                                    "type": "string"
                                                },
                                                "state": {
                                                    "type": "string",
                                                    "enum": [
                                                        "available",
                                                        "pending"
                                                    ]
                                                },
                                                "mime_type": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "size_bytes": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "uuid",
                                                "kind",
                                                "state",
                                                "mime_type",
                                                "size_bytes",
                                                "created_at"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/driver-leaves": {
            "get": {
                "operationId": "driver_leaves.index",
                "description": "Lists your company's leave entries by their start day, one page at a time. A range of dates (from and to, at most 366 days) is required unless you name one driver. Sick and emergency leave read as «leave» unless the key's owner may manage leave; the note and any certificate are never returned.\n\nRequires the key scope `driver_leaves:read`.",
                "summary": "List driver leave",
                "tags": [
                    "DriverLeave"
                ],
                "parameters": [
                    {
                        "name": "driver",
                        "in": "query",
                        "description": "Only this driver (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "state",
                        "in": "query",
                        "description": "Only entries in this state: current, upcoming, past or voided.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "upcoming"
                    },
                    {
                        "name": "from",
                        "in": "query",
                        "description": "First day of the range (YYYY-MM-DD, Saudi calendar).",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "description": "Last day of the range (YYYY-MM-DD, Saudi calendar).",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of leave entries.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "3f8b2c6e-91d4-4a7b-8c35-5e0a1d9f7b42",
                                                    "driver_uuid": "7a1c9e30-5b2d-4f68-9d14-2c8e6b0a3f51",
                                                    "kind": "annual",
                                                    "starts_on": "2026-11-15",
                                                    "ends_on": "2026-11-17",
                                                    "days": 3,
                                                    "state": "upcoming",
                                                    "voided": false,
                                                    "created_at": "2026-11-01T08:00:00Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/driver-leaves/{uuid}": {
            "get": {
                "operationId": "driver_leaves.show",
                "description": "Reads one leave entry by its uuid. An entry of another company, outside the key owner's branch, of the owner's own driver, or that does not exist answers 404 alike.\n\nRequires the key scope `driver_leaves:read`.",
                "summary": "Read a leave entry",
                "tags": [
                    "DriverLeave"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The leave entry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "3f8b2c6e-91d4-4a7b-8c35-5e0a1d9f7b42",
                                                "driver_uuid": "7a1c9e30-5b2d-4f68-9d14-2c8e6b0a3f51",
                                                "kind": "annual",
                                                "starts_on": "2026-11-15",
                                                "ends_on": "2026-11-17",
                                                "days": 3,
                                                "state": "upcoming",
                                                "voided": false,
                                                "created_at": "2026-11-01T08:00:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/driver-leave-requests": {
            "get": {
                "operationId": "driver_leave_requests.index",
                "description": "Lists the leave requests your drivers made in the app, newest first, one page at a time; the waiting ones unless you name a state. The driver's note is never returned. Requires the key scope `fleet:leave_decisions:write` and an owner who manages leave.\n\nRequires the key scope `fleet:leave_decisions:write`.",
                "summary": "List driver leave requests",
                "tags": [
                    "DriverLeaveRequestDecision"
                ],
                "parameters": [
                    {
                        "name": "state",
                        "in": "query",
                        "description": "requested (default), approved, declined or withdrawn.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "requested"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of leave requests.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "5d1f7a2c-3b8e-4c90-a6d4-8e2b1f0c9a37",
                                                    "driver_uuid": "7a1c9e30-5b2d-4f68-9d14-2c8e6b0a3f51",
                                                    "driver_name": "Ahmed Alharbi",
                                                    "kind": "annual",
                                                    "starts_on": "2026-11-20",
                                                    "ends_on": "2026-11-22",
                                                    "state": "requested",
                                                    "decline_reason": null,
                                                    "requested_at": "2026-11-17T08:00:00Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-17T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": []
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "page": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "limit": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": "integer"
                                                                                },
                                                                                []
                                                                            ]
                                                                        },
                                                                        "next_cursor": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": [
                                                                                        "string",
                                                                                        "null"
                                                                                    ]
                                                                                },
                                                                                []
                                                                            ]
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "limit",
                                                                        "next_cursor"
                                                                    ],
                                                                    "additionalProperties": []
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timezone": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "page",
                                                        "timezone"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/driver-leave-requests/{uuid}/approve": {
            "post": {
                "operationId": "driver_leave_requests.approve",
                "description": "Approves a waiting leave request: the leave is recorded and the driver is told, as in the panel. A request already decided answers 409. Requires the key scope `fleet:leave_decisions:write`, an owner who manages leave, and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:leave_decisions:write`.",
                "summary": "Approve a leave request",
                "tags": [
                    "DriverLeaveRequestDecision"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/DecideLeaveRequestRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "reason": {
                                                "type": "string",
                                                "description": "Not accepted when approving: send an empty body and no field.",
                                                "examples": [
                                                    ""
                                                ]
                                            }
                                        }
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The request, now approved.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "5d1f7a2c-3b8e-4c90-a6d4-8e2b1f0c9a37",
                                                "driver_uuid": "7a1c9e30-5b2d-4f68-9d14-2c8e6b0a3f51",
                                                "driver_name": "Ahmed Alharbi",
                                                "kind": "annual",
                                                "starts_on": "2026-11-20",
                                                "ends_on": "2026-11-22",
                                                "state": "requested",
                                                "decline_reason": null,
                                                "requested_at": "2026-11-17T08:00:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-17T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "driver_uuid": {
                                                            "type": "string"
                                                        },
                                                        "driver_name": {
                                                            "type": "string"
                                                        },
                                                        "kind": {
                                                            "type": "string"
                                                        },
                                                        "starts_on": {
                                                            "type": "string"
                                                        },
                                                        "ends_on": {
                                                            "type": "string"
                                                        },
                                                        "state": {
                                                            "type": "string"
                                                        },
                                                        "decline_reason": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "requested_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "driver_uuid",
                                                        "driver_name",
                                                        "kind",
                                                        "starts_on",
                                                        "ends_on",
                                                        "state",
                                                        "decline_reason",
                                                        "requested_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/driver-leave-requests/{uuid}/decline": {
            "post": {
                "operationId": "driver_leave_requests.decline",
                "description": "Declines a waiting leave request with a reason from a fixed list and tells the driver. A request already decided answers 409. Requires the key scope `fleet:leave_decisions:write`, an owner who manages leave, and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:leave_decisions:write`.",
                "summary": "Decline a leave request",
                "tags": [
                    "DriverLeaveRequestDecision"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/DecideLeaveRequestRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "reason": {
                                                "type": "string",
                                                "description": "period_not_possible, balance_used or other_reason.",
                                                "examples": [
                                                    "period_not_possible"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "reason"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The request, now declined.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "5d1f7a2c-3b8e-4c90-a6d4-8e2b1f0c9a37",
                                                "driver_uuid": "7a1c9e30-5b2d-4f68-9d14-2c8e6b0a3f51",
                                                "driver_name": "Ahmed Alharbi",
                                                "kind": "annual",
                                                "starts_on": "2026-11-20",
                                                "ends_on": "2026-11-22",
                                                "state": "declined",
                                                "decline_reason": "period_not_possible",
                                                "requested_at": "2026-11-17T08:00:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-17T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "driver_uuid": {
                                                            "type": "string"
                                                        },
                                                        "driver_name": {
                                                            "type": "string"
                                                        },
                                                        "kind": {
                                                            "type": "string"
                                                        },
                                                        "starts_on": {
                                                            "type": "string"
                                                        },
                                                        "ends_on": {
                                                            "type": "string"
                                                        },
                                                        "state": {
                                                            "type": "string"
                                                        },
                                                        "decline_reason": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "requested_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "driver_uuid",
                                                        "driver_name",
                                                        "kind",
                                                        "starts_on",
                                                        "ends_on",
                                                        "state",
                                                        "decline_reason",
                                                        "requested_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/drivers/{uuid}/overview": {
            "get": {
                "operationId": "drivers.overview",
                "description": "When the identity document, the driving licence and the professional card of one of your drivers end: a label, a day and the days left, only for the kinds the key's owner may read in the panel. It carries no number, file, name, figure, violation, score or training. Another company's or branch's driver is a 404.\n\nRequires the key scope `fleet:driver_overview:read`.",
                "summary": "Read a driver's overview",
                "tags": [
                    "DriverOverview"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The overview.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "expiring": [
                                                    {
                                                        "label": "Driving licence",
                                                        "detail": "Ends 2026-12-01",
                                                        "days": 17
                                                    }
                                                ]
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-14T10:00:00+00:00"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "expiring": {
                                                            "type": "array",
                                                            "items": []
                                                        }
                                                    },
                                                    "required": [
                                                        "expiring"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "type": "string"
                                                        },
                                                        "timestamp": {
                                                            "type": "string"
                                                        },
                                                        "timezone": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "timezone"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/driver-pay/sheets": {
            "get": {
                "operationId": "driver_pay.sheets",
                "description": "Lists the monthly pay sheets of your company, newest month first: month, currency, state, how many drivers it has lines for and the total of those lines. The key's owner must hold the pay right and be bound to no branch, and the opening is recorded before the figures are returned; if it cannot be recorded nothing is returned.\n\nRequires the key scope `fleet:driver_pay_sheets:read`.",
                "summary": "List pay sheets",
                "tags": [
                    "DriverPayRead"
                ],
                "parameters": [
                    {
                        "name": "state",
                        "in": "query",
                        "description": "Only sheets in this state: draft, reviewed, approved, paid or cancelled.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "approved"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "One page of sheets.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "ref": "Xk3dQ0m1v8aB2cD4eF5gHw",
                                                    "month": "2026-10",
                                                    "currency": "SAR",
                                                    "state": "approved",
                                                    "drivers": 12,
                                                    "total": "41250.00"
                                                }
                                            ],
                                            "meta": {
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "page": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "limit": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": "integer"
                                                                                },
                                                                                []
                                                                            ]
                                                                        },
                                                                        "next_cursor": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": [
                                                                                        "string",
                                                                                        "null"
                                                                                    ]
                                                                                },
                                                                                []
                                                                            ]
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "limit",
                                                                        "next_cursor"
                                                                    ],
                                                                    "additionalProperties": []
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timezone": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "page",
                                                        "timezone"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "post": {
                "operationId": "driver_pay.sheets.compute",
                "description": "Computes the draft sheet of a month (a past one or the month in progress) in one currency, as the panel does; a sheet is reviewed only once its month is over. The answer holds the sheet's ref and state, never a figure; read the lines with the sheets scope. A month that already has a sheet in this currency answers 409. Reviewing, approving and paying stay in the panel.\n\nRequires the key scope `fleet:driver_pay_sheets:compute`.",
                "summary": "Compute a draft pay sheet",
                "tags": [
                    "DriverPayWrite"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/ComputePaySheetRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "month": {
                                                "type": "string",
                                                "description": "The month, Y-m: a past month or the month in progress, never a future one.",
                                                "examples": [
                                                    "2026-10"
                                                ]
                                            },
                                            "currency": {
                                                "type": "string",
                                                "description": "A three-letter code the company has enabled; the default when left out.",
                                                "examples": [
                                                    "SAR"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "month"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The draft sheet.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "ref": "Xk3dQ0m1v8aB2cD4eF5gHw",
                                                "state": "draft"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "ref": {
                                                    "type": "string"
                                                },
                                                "state": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "ref",
                                                "state"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/driver-pay/sheets/{ref}": {
            "get": {
                "operationId": "driver_pay.sheet",
                "description": "Reads one pay sheet by its ref with its lines: for each driver (by uuid) the days paid, the days of the month, the basic pay, the allowances and the total. A sheet of another company answers 404 like one that does not exist.\n\nRequires the key scope `fleet:driver_pay_sheets:read`.",
                "summary": "Read a pay sheet",
                "tags": [
                    "DriverPayRead"
                ],
                "parameters": [
                    {
                        "name": "ref",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The sheet with its lines.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "ref": "Xk3dQ0m1v8aB2cD4eF5gHw",
                                                "month": "2026-10",
                                                "currency": "SAR",
                                                "state": "approved",
                                                "lines": [
                                                    {
                                                        "driver_uuid": "7c1d2e44-5b6a-4f0e-9a3b-1d2c3e4f5a6b",
                                                        "days_paid": 31,
                                                        "days_in_month": 31,
                                                        "basic": "3000.00",
                                                        "allowances": "450.00",
                                                        "total": "3450.00"
                                                    }
                                                ]
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "ref": {
                                                            "type": "string"
                                                        },
                                                        "month": {
                                                            "type": "string"
                                                        },
                                                        "currency": {
                                                            "type": "string"
                                                        },
                                                        "state": {
                                                            "type": "string"
                                                        },
                                                        "lines": {
                                                            "type": "array",
                                                            "items": {
                                                                "type": "string"
                                                            }
                                                        }
                                                    },
                                                    "required": [
                                                        "ref",
                                                        "month",
                                                        "currency",
                                                        "state",
                                                        "lines"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/driver-pay/ledger": {
            "get": {
                "operationId": "driver_pay.ledger",
                "description": "Lists the advances, deductions and additions of your company's drivers, newest first: kind, amount, instalment, reason code, state and the driver by uuid. A note is never returned. The opening is recorded before the figures are returned.\n\nRequires the key scope `fleet:driver_pay_ledger:read`.",
                "summary": "List pay ledger entries",
                "tags": [
                    "DriverPayRead"
                ],
                "parameters": [
                    {
                        "name": "state",
                        "in": "query",
                        "description": "Only entries in this state: proposed, approved or cancelled.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "proposed"
                    },
                    {
                        "name": "kind",
                        "in": "query",
                        "description": "Only this kind: advance, deduction or addition.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "advance"
                    },
                    {
                        "name": "driver",
                        "in": "query",
                        "description": "Only this driver (their uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "One page of entries.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "ref": "Pq9dQ0m1v8aB2cD4eF5gHw",
                                                    "driver_uuid": "7c1d2e44-5b6a-4f0e-9a3b-1d2c3e4f5a6b",
                                                    "kind": "advance",
                                                    "amount": "1500.00",
                                                    "currency": "SAR",
                                                    "instalment": "500.00",
                                                    "reason_code": null,
                                                    "state": "proposed",
                                                    "created_at": "2026-11-02T08:15:00Z"
                                                }
                                            ],
                                            "meta": {
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "page": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "limit": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": "integer"
                                                                                },
                                                                                []
                                                                            ]
                                                                        },
                                                                        "next_cursor": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": [
                                                                                        "string",
                                                                                        "null"
                                                                                    ]
                                                                                },
                                                                                []
                                                                            ]
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "limit",
                                                                        "next_cursor"
                                                                    ],
                                                                    "additionalProperties": []
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timezone": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "page",
                                                        "timezone"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    },
                                                    "minItems": 0,
                                                    "maxItems": 0
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "page": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "limit": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": "integer"
                                                                                },
                                                                                []
                                                                            ]
                                                                        },
                                                                        "next_cursor": []
                                                                    },
                                                                    "required": [
                                                                        "limit",
                                                                        "next_cursor"
                                                                    ],
                                                                    "additionalProperties": []
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timezone": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "page",
                                                        "timezone"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "post": {
                "operationId": "driver_pay.ledger.propose",
                "description": "Proposes an advance, a deduction or an addition to one driver's pay, as the panel does. The key's owner is the proposer, so a second person must approve it in the panel; nothing is approved or paid here. The amount is in minor units within a ceiling, an advance needs its instalment, a deduction or addition needs a reason code, and a note is required. Capped per key and per company in a day.\n\nRequires the key scope `fleet:driver_pay_ledger:propose`.",
                "summary": "Propose a pay ledger entry",
                "tags": [
                    "DriverPayWrite"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/ProposePayLedgerEntryRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "driver": {
                                                "type": "string",
                                                "format": "uuid",
                                                "description": "The driver, by their uuid."
                                            },
                                            "kind": {
                                                "type": "string",
                                                "description": "advance, deduction or addition.",
                                                "examples": [
                                                    "advance"
                                                ]
                                            },
                                            "amount_minor": {
                                                "type": "integer",
                                                "description": "The amount in the currency's minor unit, greater than zero and within the ceiling.",
                                                "examples": [
                                                    150000
                                                ]
                                            },
                                            "currency": {
                                                "type": "string",
                                                "description": "A three-letter code the company has enabled; the default when left out.",
                                                "examples": [
                                                    "SAR"
                                                ]
                                            },
                                            "instalment_minor": {
                                                "type": "integer",
                                                "description": "An advance only: what is taken back each month, not above the amount.",
                                                "examples": [
                                                    50000
                                                ]
                                            },
                                            "reason_code": {
                                                "type": "string",
                                                "description": "A deduction or addition only: traffic_fine, accident, damage, shortage, absence, bonus or other, as the kind allows.",
                                                "examples": [
                                                    "bonus"
                                                ]
                                            },
                                            "note": {
                                                "type": "string",
                                                "description": "Why, plain text without a card number.",
                                                "examples": [
                                                    "Advance for the school fees"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "driver",
                                            "kind",
                                            "amount_minor",
                                            "note"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The entry that was proposed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "ref": "Pq9dQ0m1v8aB2cD4eF5gHw",
                                                "state": "proposed"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "ref": {
                                                    "type": "string"
                                                },
                                                "state": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "ref",
                                                "state"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/driver-pay/items": {
            "get": {
                "operationId": "driver_pay.items",
                "description": "Lists the allowance items your company names for its drivers' pay, oldest first: the code, both names and whether the item is archived. No amount and no driver is part of it, and the opening is recorded first.\n\nRequires the key scope `fleet:driver_pay_items:read`.",
                "summary": "List pay allowance items",
                "tags": [
                    "DriverPayRead"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "One page of items.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "code": "housing",
                                                    "name_ar": "سكن",
                                                    "name_en": "Housing",
                                                    "archived": false
                                                }
                                            ],
                                            "meta": {
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "page": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "limit": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": "integer"
                                                                                },
                                                                                []
                                                                            ]
                                                                        },
                                                                        "next_cursor": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": [
                                                                                        "string",
                                                                                        "null"
                                                                                    ]
                                                                                },
                                                                                []
                                                                            ]
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "limit",
                                                                        "next_cursor"
                                                                    ],
                                                                    "additionalProperties": []
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timezone": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "page",
                                                        "timezone"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/driver-pay/terms": {
            "get": {
                "operationId": "driver_pay.terms",
                "description": "Lists, for each driver, the pay term in force today: the day it took effect, the basic pay, the currency and how a trip is paid. Earlier terms and the reason text are never returned, and a term is never changed here. The opening is recorded before the figures are returned.\n\nRequires the key scope `fleet:driver_pay_terms:read`.",
                "summary": "List the pay terms in force",
                "tags": [
                    "DriverPayRead"
                ],
                "parameters": [
                    {
                        "name": "driver",
                        "in": "query",
                        "description": "Only this driver (their uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "One page of terms.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "driver_uuid": "7c1d2e44-5b6a-4f0e-9a3b-1d2c3e4f5a6b",
                                                    "effective_from": "2026-01-01",
                                                    "basic": "3000.00",
                                                    "currency": "SAR",
                                                    "trip_basis": "none",
                                                    "trip_value": null
                                                }
                                            ],
                                            "meta": {
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "page": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "limit": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": "integer"
                                                                                },
                                                                                []
                                                                            ]
                                                                        },
                                                                        "next_cursor": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": [
                                                                                        "string",
                                                                                        "null"
                                                                                    ]
                                                                                },
                                                                                []
                                                                            ]
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "limit",
                                                                        "next_cursor"
                                                                    ],
                                                                    "additionalProperties": []
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timezone": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "page",
                                                        "timezone"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    },
                                                    "minItems": 0,
                                                    "maxItems": 0
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "page": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "limit": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": "integer"
                                                                                },
                                                                                []
                                                                            ]
                                                                        },
                                                                        "next_cursor": []
                                                                    },
                                                                    "required": [
                                                                        "limit",
                                                                        "next_cursor"
                                                                    ],
                                                                    "additionalProperties": []
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timezone": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "page",
                                                        "timezone"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/driver-pay/ledger/{ref}/cancel": {
            "post": {
                "operationId": "driver_pay.ledger.cancel",
                "description": "Cancels an entry that is still waiting for a decision, with a reason. An entry that was approved or cancelled already answers 409: an approved entry moves money and is cancelled in the panel only.\n\nRequires the key scope `fleet:driver_pay_ledger:cancel`.",
                "summary": "Cancel a pay ledger entry",
                "tags": [
                    "DriverPayWrite"
                ],
                "parameters": [
                    {
                        "name": "ref",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/CancelPayLedgerEntryRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "reason": {
                                                "type": "string",
                                                "description": "Why, plain text without a card number.",
                                                "examples": [
                                                    "Proposed for the wrong driver"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "reason"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The entry after the cancellation.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "ref": "Pq9dQ0m1v8aB2cD4eF5gHw",
                                                "state": "cancelled"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "ref": {
                                                            "type": "string"
                                                        },
                                                        "state": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "ref",
                                                        "state"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/drivers/proposals": {
            "post": {
                "operationId": "drivers.proposals.store",
                "description": "Proposes a new driver of your company by name only: a proposal is not a driver. A different user of your company completes it in the panel, typing the identity, the nationality, the mobile and the rest, and only then does the driver exist; until then it waits at most 30 days. Nothing but `full_name` can be sent (422 naming the key). The answer is the proposal with its state. A name already waiting answers 409 `open_duplicate`; a company with 200 waiting answers 429 `open_proposals`. At most 20 proposals an hour for one key and 100 a day for one company. Retry safely with the same Idempotency-Key.\n\nRequires the key scope `fleet:driver_proposals:write`.",
                "summary": "Propose a driver",
                "tags": [
                    "DriverProposal"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/ProposeDriverRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "full_name": {
                                                "type": "object",
                                                "description": "The name in Arabic and English, plain text up to 150 characters each; at least one.",
                                                "examples": [
                                                    {
                                                        "ar": "أحمد محمد",
                                                        "en": "Ahmed Mohammed"
                                                    }
                                                ]
                                            }
                                        },
                                        "required": [
                                            "full_name"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The proposal, waiting.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "8c2f1d44-6a3b-4e9d-b1c5-2f7e0a9d3b61",
                                                "state": "proposed",
                                                "full_name": {
                                                    "ar": "أحمد محمد",
                                                    "en": "Ahmed Mohammed"
                                                },
                                                "driver_uuid": null,
                                                "decision_note": null,
                                                "created_at": "2026-06-01T09:00:00Z",
                                                "expires_at": "2026-07-01T09:00:00Z",
                                                "decided_at": null
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uuid": {
                                                    "type": "string"
                                                },
                                                "state": {
                                                    "type": "string"
                                                },
                                                "full_name": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "additionalProperties": {
                                                        "type": "string"
                                                    }
                                                },
                                                "driver_uuid": [],
                                                "decision_note": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "created_at": {
                                                    "type": "string"
                                                },
                                                "expires_at": {
                                                    "type": "string"
                                                },
                                                "decided_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "uuid",
                                                "state",
                                                "full_name",
                                                "driver_uuid",
                                                "decision_note",
                                                "created_at",
                                                "expires_at",
                                                "decided_at"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "get": {
                "operationId": "drivers.proposals.index",
                "description": "The latest 100 proposals of your company, newest first, optionally of one state. Read one by its uuid for the rest.\n\nRequires the key scope `fleet:driver_proposals:write`.",
                "summary": "List driver proposals",
                "tags": [
                    "DriverProposal"
                ],
                "parameters": [
                    {
                        "name": "state",
                        "in": "query",
                        "description": "Only the proposals in this state.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "proposed"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The proposals.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "8c2f1d44-6a3b-4e9d-b1c5-2f7e0a9d3b61",
                                                    "state": "proposed",
                                                    "full_name": {
                                                        "ar": "أحمد محمد",
                                                        "en": "Ahmed Mohammed"
                                                    },
                                                    "driver_uuid": null,
                                                    "decision_note": null,
                                                    "created_at": "2026-06-01T09:00:00Z",
                                                    "expires_at": "2026-07-01T09:00:00Z",
                                                    "decided_at": null
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 100,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "string"
                                            }
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer",
                                                                            "const": 100
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": []
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/drivers/proposals/{uuid}": {
            "get": {
                "operationId": "drivers.proposals.show",
                "description": "The state of one proposal of your company: `proposed`, `approved`, `rejected`, `cancelled` or `expired`; `driver_uuid` once it became a driver, the decision note only when it was rejected, and the name until it is blanked 90 days after the decision. A proposal of another company answers 404.\n\nRequires the key scope `fleet:driver_proposals:write`.",
                "summary": "Read a driver proposal",
                "tags": [
                    "DriverProposal"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The proposal.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "8c2f1d44-6a3b-4e9d-b1c5-2f7e0a9d3b61",
                                                "state": "proposed",
                                                "full_name": {
                                                    "ar": "أحمد محمد",
                                                    "en": "Ahmed Mohammed"
                                                },
                                                "driver_uuid": null,
                                                "decision_note": null,
                                                "created_at": "2026-06-01T09:00:00Z",
                                                "expires_at": "2026-07-01T09:00:00Z",
                                                "decided_at": null
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "state": {
                                                            "type": "string"
                                                        },
                                                        "full_name": {
                                                            "type": [
                                                                "object",
                                                                "null"
                                                            ],
                                                            "additionalProperties": {
                                                                "type": "string"
                                                            }
                                                        },
                                                        "driver_uuid": [],
                                                        "decision_note": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "created_at": {
                                                            "type": "string"
                                                        },
                                                        "expires_at": {
                                                            "type": "string"
                                                        },
                                                        "decided_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "state",
                                                        "full_name",
                                                        "driver_uuid",
                                                        "decision_note",
                                                        "created_at",
                                                        "expires_at",
                                                        "decided_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/driver-roster-entries": {
            "get": {
                "operationId": "driver_roster_entries.index",
                "description": "Lists the standing roster entries of your company's drivers, one page at a time (at most 100): the driver and the template by uuid and the Riyadh days the driver follows it (no end day while it runs on). Voided entries are never listed. Requires the fleet:driver_shifts:read scope; every read is recorded.\n\nRequires the key scope `fleet:driver_shifts:read`.",
                "summary": "List the driver roster",
                "tags": [
                    "DriverRosterEntry"
                ],
                "parameters": [
                    {
                        "name": "driver",
                        "in": "query",
                        "description": "Only this driver (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "template",
                        "in": "query",
                        "description": "Only this shift template (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "on",
                        "in": "query",
                        "description": "Only the entries a driver follows on this day (YYYY-MM-DD, Saudi calendar).",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of roster entries.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "2e8a5d40-1c7b-4b96-9f03-6a4c8e1d7b52",
                                                    "driver_uuid": "7a1c9e30-5b2d-4f68-9d14-2c8e6b0a3f51",
                                                    "template_uuid": "9c4e1b72-6a05-4f3d-8e21-7b0d3a5c9f18",
                                                    "starts_on": "2026-11-01",
                                                    "ends_on": null,
                                                    "state": "current",
                                                    "created_at": "2026-11-01T08:00:00Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-20T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": []
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "page": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "limit": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": "integer"
                                                                                },
                                                                                []
                                                                            ]
                                                                        },
                                                                        "next_cursor": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": [
                                                                                        "string",
                                                                                        "null"
                                                                                    ]
                                                                                },
                                                                                []
                                                                            ]
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "limit",
                                                                        "next_cursor"
                                                                    ],
                                                                    "additionalProperties": []
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timezone": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "page",
                                                        "timezone"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/driver-roster-entries/{uuid}": {
            "get": {
                "operationId": "driver_roster_entries.show",
                "description": "Reads one standing roster entry by its uuid. An entry of another company, outside the key owner's branch, voided, or that does not exist answers 404 alike. Requires the fleet:driver_shifts:read scope; the read is recorded.\n\nRequires the key scope `fleet:driver_shifts:read`.",
                "summary": "Read a roster entry",
                "tags": [
                    "DriverRosterEntry"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The roster entry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "2e8a5d40-1c7b-4b96-9f03-6a4c8e1d7b52",
                                                "driver_uuid": "7a1c9e30-5b2d-4f68-9d14-2c8e6b0a3f51",
                                                "template_uuid": "9c4e1b72-6a05-4f3d-8e21-7b0d3a5c9f18",
                                                "starts_on": "2026-11-01",
                                                "ends_on": null,
                                                "state": "current",
                                                "created_at": "2026-11-01T08:00:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-20T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "driver_uuid": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "template_uuid": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "starts_on": {
                                                            "type": "string"
                                                        },
                                                        "ends_on": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "state": {
                                                            "type": "string"
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "driver_uuid",
                                                        "template_uuid",
                                                        "starts_on",
                                                        "ends_on",
                                                        "state",
                                                        "created_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "type": "string"
                                                        },
                                                        "timestamp": {
                                                            "type": "string"
                                                        },
                                                        "timezone": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "timezone"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/driver-shift-templates": {
            "get": {
                "operationId": "driver_shift_templates.index",
                "description": "Lists your company's shift templates, one page at a time (at most 100): the name, the working days as ISO weekdays (1 Monday to 7 Sunday), the start and end time in Riyadh and whether the shift runs past midnight. Live templates only unless you ask for the voided ones. Requires the fleet:driver_shifts:read scope.\n\nRequires the key scope `fleet:driver_shifts:read`.",
                "summary": "List shift templates",
                "tags": [
                    "DriverShiftTemplate"
                ],
                "parameters": [
                    {
                        "name": "state",
                        "in": "query",
                        "description": "live (the default) or voided.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "live"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of shift templates.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "9c4e1b72-6a05-4f3d-8e21-7b0d3a5c9f18",
                                                    "name": "Morning",
                                                    "weekdays": [
                                                        6,
                                                        7,
                                                        1,
                                                        2,
                                                        3,
                                                        4
                                                    ],
                                                    "starts_at": "06:00",
                                                    "ends_at": "14:00",
                                                    "crosses_midnight": false,
                                                    "company_wide": true,
                                                    "state": "live",
                                                    "created_at": "2026-11-20T08:00:00Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-20T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": []
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "page": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "limit": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": "integer"
                                                                                },
                                                                                []
                                                                            ]
                                                                        },
                                                                        "next_cursor": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": [
                                                                                        "string",
                                                                                        "null"
                                                                                    ]
                                                                                },
                                                                                []
                                                                            ]
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "limit",
                                                                        "next_cursor"
                                                                    ],
                                                                    "additionalProperties": []
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timezone": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "page",
                                                        "timezone"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/driver-shift-templates/{uuid}": {
            "get": {
                "operationId": "driver_shift_templates.show",
                "description": "Reads one shift template by its uuid. A template of another company, outside the key owner's branch, or that does not exist answers 404 alike. Requires the fleet:driver_shifts:read scope.\n\nRequires the key scope `fleet:driver_shifts:read`.",
                "summary": "Read a shift template",
                "tags": [
                    "DriverShiftTemplate"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The shift template.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "9c4e1b72-6a05-4f3d-8e21-7b0d3a5c9f18",
                                                "name": "Morning",
                                                "weekdays": [
                                                    6,
                                                    7,
                                                    1,
                                                    2,
                                                    3,
                                                    4
                                                ],
                                                "starts_at": "06:00",
                                                "ends_at": "14:00",
                                                "crosses_midnight": false,
                                                "company_wide": true,
                                                "state": "live",
                                                "created_at": "2026-11-20T08:00:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-20T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        },
                                                        "weekdays": {
                                                            "type": "array",
                                                            "items": []
                                                        },
                                                        "starts_at": {
                                                            "type": "string"
                                                        },
                                                        "ends_at": {
                                                            "type": "string"
                                                        },
                                                        "crosses_midnight": {
                                                            "type": "string"
                                                        },
                                                        "company_wide": {
                                                            "type": "string"
                                                        },
                                                        "state": {
                                                            "type": "string",
                                                            "enum": [
                                                                "voided",
                                                                "live"
                                                            ]
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "name",
                                                        "weekdays",
                                                        "starts_at",
                                                        "ends_at",
                                                        "crosses_midnight",
                                                        "company_wide",
                                                        "state",
                                                        "created_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "type": "string"
                                                        },
                                                        "timestamp": {
                                                            "type": "string"
                                                        },
                                                        "timezone": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "timezone"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/driver-trainings": {
            "get": {
                "operationId": "driver_trainings.index",
                "description": "Lists your company's training entries, oldest first, one page at a time. A range of dates (from and to on the completion day, at most 366 days) is required unless you name one driver. Costs, notes and void reasons are never returned.\n\nRequires the key scope `driver_trainings:read`.",
                "summary": "List driver training",
                "tags": [
                    "DriverTraining"
                ],
                "parameters": [
                    {
                        "name": "driver",
                        "in": "query",
                        "description": "Only this driver (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "result",
                        "in": "query",
                        "description": "Only entries with this result: passed, failed, attended or in_progress.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "passed"
                    },
                    {
                        "name": "from",
                        "in": "query",
                        "description": "First completion day of the range (YYYY-MM-DD, Saudi calendar).",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "description": "Last completion day of the range (YYYY-MM-DD, Saudi calendar).",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of training entries.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "3f8b2c6e-91d4-4a7b-8c35-5e0a1d9f7b42",
                                                    "driver_uuid": "7a1c9e30-5b2d-4f68-9d14-2c8e6b0a3f51",
                                                    "course": "Defensive driving",
                                                    "provider": "Road Safety Academy",
                                                    "completed_on": "2026-10-12",
                                                    "result": "passed",
                                                    "certificate_ends_on": "2028-10-12",
                                                    "voided": false
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/driver-trainings/{uuid}": {
            "get": {
                "operationId": "driver_trainings.show",
                "description": "Reads one training entry by its uuid. An entry of another company, outside the key owner's branch, of the owner's own driver, or that does not exist answers 404 alike.\n\nRequires the key scope `driver_trainings:read`.",
                "summary": "Read a training entry",
                "tags": [
                    "DriverTraining"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The training entry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "3f8b2c6e-91d4-4a7b-8c35-5e0a1d9f7b42",
                                                "driver_uuid": "7a1c9e30-5b2d-4f68-9d14-2c8e6b0a3f51",
                                                "course": "Defensive driving",
                                                "provider": "Road Safety Academy",
                                                "completed_on": "2026-10-12",
                                                "result": "passed",
                                                "certificate_ends_on": "2028-10-12",
                                                "voided": false
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/video/events": {
            "get": {
                "operationId": "video.events.index",
                "description": "Lists your company's camera events, oldest first, one page at a time. Each carries the vehicle, the kind of event, its severity, when it happened and was received, whether a person judged it and its footage as lines (kind, camera, length, size, status, whether pinned and until when it is kept). The driver, the position, the speed, the stored file and the footage itself are never shown. Every successful request is recorded as a read of confidential records. A branch-limited key sees only the events of its branch.\n\nRequires the key scope `video:events:read`.",
                "summary": "List camera events",
                "tags": [
                    "Event"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only events in this review state: unreviewed, valid or invalid.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "unreviewed"
                    },
                    {
                        "name": "vehicle",
                        "in": "query",
                        "description": "Only the events of this vehicle (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "branch",
                        "in": "query",
                        "description": "Only the events of this branch (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only events received at or after this moment (ISO 8601 with an offset, e.g. 2026-05-01T00:00:00Z).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of camera events.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "3c8e1f52-6a47-4d90-b2e1-8f5a0c7d9e14",
                                                    "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                    "kind": "dsm_phone",
                                                    "severity": 6,
                                                    "occurred_at": "2026-05-12T07:48:00Z",
                                                    "received_at": "2026-05-12T07:48:09Z",
                                                    "review_state": "unreviewed",
                                                    "has_footage": true,
                                                    "footage": [
                                                        {
                                                            "uuid": "9d2b7c4e-1f63-4a08-8c5d-6e0a3b1f7d25",
                                                            "kind": "clip",
                                                            "camera_channel": 1,
                                                            "duration_seconds": 20,
                                                            "bytes": 3145728,
                                                            "mime": "video/mp4",
                                                            "captured_at": "2026-05-12T07:47:50Z",
                                                            "status": "available",
                                                            "pinned": false,
                                                            "retention_until": "2026-06-11T07:48:09Z"
                                                        }
                                                    ]
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "post": {
                "operationId": "video.events",
                "description": "Stores camera events (driver monitoring, driving assistance and blind-spot alarms) raised by your camera platform. Each event names its camera by device_id, the id your account maps to a vehicle, and its kind by one of the canonical kinds; the vehicle and the driver of that moment are found from your account's mappings, never from the body. Every event is answered on its own in the same order: accepted, duplicate (the same event_id with the same kind and time was already stored) or refused with a reason: not_enabled (the company has not enabled camera video), plan (the plan does not include it), kind_not_enabled, unknown_device (no vehicle is mapped to that device at that time), identity_mismatch, identity_conflict, identity_unavailable or event_id_reused (the same event_id with another kind or time). An event time is ISO 8601 with a zone or epoch milliseconds, at most five minutes ahead and thirty days old. A batch holds at most 100 events by default; an empty or larger one, or invalid fields, answer 422 with one detail per field; a body over the size limit answers 413. A refused event stores nothing, and clips or snapshots are sent separately.",
                "summary": "Send camera events",
                "tags": [
                    "VideoEventIngest"
                ],
                "parameters": [
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "events": {
                                        "type": "array",
                                        "description": "One or more camera events. Fields: event_id (your id, unique per event), device_id (the camera device id your account maps), kind (dsm_fatigue, dsm_distraction, dsm_phone, dsm_smoking, dsm_yawning, dsm_driver_absent, dsm_camera_covered, dsm_seatbelt, adas_forward_collision, adas_headway, adas_lane_departure, adas_pedestrian, bsd_vehicle, bsd_pedestrian), occurred_at or occurred_at_epoch_ms; optional imei (a consistency check), latitude and longitude together, speed_kmh, severity (0 to 10, your device's own scale) and raw (an object of up to 8 KB).",
                                        "examples": [
                                            [
                                                {
                                                    "event_id": "evt-2026-11-07-0001",
                                                    "device_id": "cam-1234",
                                                    "kind": "dsm_fatigue",
                                                    "occurred_at": "2026-11-07T08:15:30Z",
                                                    "latitude": 24.7136,
                                                    "longitude": 46.6753,
                                                    "speed_kmh": 72.5,
                                                    "severity": 2
                                                }
                                            ]
                                        ],
                                        "items": []
                                    }
                                },
                                "required": [
                                    "events"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Nothing new is stored: every event was already stored or was refused.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "received": 1,
                                                "accepted": 0,
                                                "duplicates": 1,
                                                "refused": 0,
                                                "results": [
                                                    {
                                                        "event_id": "evt-2026-11-07-0001",
                                                        "status": "duplicate",
                                                        "reason": null
                                                    }
                                                ]
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "7f3c9a1e-2b4d-4c8e-9f10-000000000000",
                                                "timestamp": "2026-11-07T08:20:00Z"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "202": {
                        "description": "At least one event is stored.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "received": 2,
                                                "accepted": 1,
                                                "duplicates": 0,
                                                "refused": 1,
                                                "results": [
                                                    {
                                                        "event_id": "evt-2026-11-07-0001",
                                                        "status": "accepted",
                                                        "reason": null
                                                    },
                                                    {
                                                        "event_id": "evt-2026-11-07-0002",
                                                        "status": "refused",
                                                        "reason": "unknown_device"
                                                    }
                                                ]
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "7f3c9a1e-2b4d-4c8e-9f10-000000000000",
                                                "timestamp": "2026-11-07T08:15:31Z"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the source token is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string",
                                    "examples": [
                                        {
                                            "success": false,
                                            "data": null,
                                            "error": {
                                                "code": "unauthenticated",
                                                "message": "Authentication is required."
                                            },
                                            "meta": {
                                                "request_id": "7f3c9a1e-2b4d-4c8e-9f10-000000000000",
                                                "timestamp": "2026-11-07T08:15:31Z"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "payload_too_large: the request body is over the size limit.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string",
                                    "examples": [
                                        {
                                            "success": false,
                                            "data": null,
                                            "error": {
                                                "code": "payload_too_large",
                                                "message": "The request body is too large."
                                            },
                                            "meta": {
                                                "request_id": "7f3c9a1e-2b4d-4c8e-9f10-000000000000",
                                                "timestamp": "2026-11-07T08:15:31Z"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "415": {
                        "description": "unsupported_media_type: send Content-Type application/json.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string",
                                    "examples": [
                                        {
                                            "success": false,
                                            "data": null,
                                            "error": {
                                                "code": "unsupported_media_type",
                                                "message": "The request body must be application/json."
                                            },
                                            "meta": {
                                                "request_id": "7f3c9a1e-2b4d-4c8e-9f10-000000000000",
                                                "timestamp": "2026-11-07T08:15:31Z"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: one detail per invalid field, or an empty batch or one with more events than allowed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string",
                                    "examples": [
                                        {
                                            "success": false,
                                            "data": null,
                                            "error": {
                                                "code": "validation_failed",
                                                "message": "The request contains invalid fields.",
                                                "details": [
                                                    {
                                                        "field": "events.0.kind",
                                                        "code": "unknown_value",
                                                        "message": "This value is not one of the allowed values."
                                                    }
                                                ]
                                            },
                                            "meta": {
                                                "request_id": "7f3c9a1e-2b4d-4c8e-9f10-000000000000",
                                                "timestamp": "2026-11-07T08:15:31Z"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/video/events/{uuid}": {
            "get": {
                "operationId": "video.events.show",
                "description": "Reads one of your company's camera events by its uuid. An event of another company or branch answers 404 exactly like one that does not exist. A successful request is recorded as a read of confidential records.\n\nRequires the key scope `video:events:read`.",
                "summary": "Read a camera event",
                "tags": [
                    "Event"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The camera event.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "3c8e1f52-6a47-4d90-b2e1-8f5a0c7d9e14",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "kind": "dsm_phone",
                                                "severity": 6,
                                                "occurred_at": "2026-05-12T07:48:00Z",
                                                "received_at": "2026-05-12T07:48:09Z",
                                                "review_state": "unreviewed",
                                                "has_footage": true,
                                                "footage": [
                                                    {
                                                        "uuid": "9d2b7c4e-1f63-4a08-8c5d-6e0a3b1f7d25",
                                                        "kind": "clip",
                                                        "camera_channel": 1,
                                                        "duration_seconds": 20,
                                                        "bytes": 3145728,
                                                        "mime": "video/mp4",
                                                        "captured_at": "2026-05-12T07:47:50Z",
                                                        "status": "available",
                                                        "pinned": false,
                                                        "retention_until": "2026-06-11T07:48:09Z"
                                                    }
                                                ]
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "additionalProperties": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/expenses": {
            "get": {
                "operationId": "expenses.index",
                "description": "Lists your company's vehicle expenses, oldest first, one page at a time. Each carries the vehicle and branch by uuid, type, date, amount in minor units, supplier and reference, which are free text as your staff typed them; notes and receipts are never shown. A branch-limited key sees only the expenses recorded under its own branch: the other record types follow the vehicle's current branch, so when a vehicle moves its old expenses stay with the old branch.\n\nRequires the key scope `expenses:read`.",
                "summary": "List expenses",
                "tags": [
                    "Expense"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only expenses in this state: active or voided. Voided expenses are left out unless you ask for them.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "voided"
                    },
                    {
                        "name": "vehicle",
                        "in": "query",
                        "description": "Only the vehicle expenses of this vehicle (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "branch",
                        "in": "query",
                        "description": "Only expenses of this branch (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only vehicle expenses changed at or after this moment (ISO 8601 with an offset, e.g. 2026-05-01T00:00:00Z).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of vehicle expenses.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "7e1c4a92-3d58-4f06-a9b3-2b6d8e0f5c14",
                                                    "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                    "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                    "expense_type_code": "fuel",
                                                    "spent_on": "2026-05-12",
                                                    "amount_minor": 34250,
                                                    "currency": "SAR",
                                                    "supplier": "Al Rajhi Fuel Station",
                                                    "reference": "INV-20481",
                                                    "voided_at": null,
                                                    "created_at": "2026-05-12T12:00:00Z",
                                                    "updated_at": "2026-05-12T12:00:00Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "post": {
                "operationId": "expenses.record",
                "description": "Records an expense on one of your company's vehicles, as the panel does: its type, the day it was spent (not in the future), the amount in minor units and the supplier, reference and note. The company's rules apply exactly as in the panel. A driver and a receipt cannot be sent. Send an Idempotency-Key header so a retry does not record it twice. Requires the key scope `fleet:expenses:write`.\n\nRequires the key scope `fleet:expenses:write`.",
                "summary": "Record a vehicle expense",
                "tags": [
                    "ExpenseWrite"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/RecordExpenseRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "vehicle": {
                                                "type": "string",
                                                "format": "uuid",
                                                "description": "The vehicle, by its uuid.",
                                                "examples": [
                                                    "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11"
                                                ]
                                            },
                                            "expense_type_code": {
                                                "type": "string",
                                                "description": "The code of an active expense type.",
                                                "examples": [
                                                    "tolls"
                                                ]
                                            },
                                            "spent_on": {
                                                "type": "string",
                                                "format": "date",
                                                "description": "The day it was spent, Y-m-d.",
                                                "examples": [
                                                    "2026-05-12"
                                                ]
                                            },
                                            "amount_minor": {
                                                "type": "integer",
                                                "description": "The amount in the currency's minor unit, greater than zero.",
                                                "examples": [
                                                    34250
                                                ]
                                            },
                                            "currency": {
                                                "type": "string",
                                                "description": "A three-letter code the company has enabled; the company's default when left out.",
                                                "examples": [
                                                    "SAR"
                                                ]
                                            },
                                            "supplier": {
                                                "type": "string",
                                                "description": "Who was paid, plain text.",
                                                "examples": [
                                                    "Al Rajhi Fuel Station"
                                                ]
                                            },
                                            "reference": {
                                                "type": "string",
                                                "description": "The receipt or invoice number, plain text.",
                                                "examples": [
                                                    "INV-20481"
                                                ]
                                            },
                                            "note": {
                                                "type": "string",
                                                "description": "A note for your staff, plain text.",
                                                "examples": [
                                                    "Paid in cash"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "vehicle",
                                            "expense_type_code",
                                            "spent_on",
                                            "amount_minor"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The expense that was recorded.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "7e1c4a92-3d58-4f06-a9b3-2b6d8e0f5c14",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                "expense_type_code": "fuel",
                                                "spent_on": "2026-05-12",
                                                "amount_minor": 34250,
                                                "currency": "SAR",
                                                "supplier": "Al Rajhi Fuel Station",
                                                "reference": "INV-20481",
                                                "voided_at": null,
                                                "created_at": "2026-05-12T12:00:00Z",
                                                "updated_at": "2026-05-12T12:00:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uuid": {
                                                    "type": "string"
                                                },
                                                "vehicle_uuid": {
                                                    "type": "string"
                                                },
                                                "branch_uuid": {
                                                    "type": "string"
                                                },
                                                "expense_type_code": {
                                                    "type": "string"
                                                },
                                                "spent_on": {
                                                    "type": "string"
                                                },
                                                "amount_minor": {
                                                    "type": "string"
                                                },
                                                "currency": {
                                                    "type": "string"
                                                },
                                                "supplier": {
                                                    "type": "string"
                                                },
                                                "reference": {
                                                    "type": "string"
                                                },
                                                "voided_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "uuid",
                                                "vehicle_uuid",
                                                "branch_uuid",
                                                "expense_type_code",
                                                "spent_on",
                                                "amount_minor",
                                                "currency",
                                                "supplier",
                                                "reference",
                                                "voided_at",
                                                "created_at",
                                                "updated_at"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/expenses/{uuid}": {
            "get": {
                "operationId": "expenses.show",
                "description": "Reads one of your company's vehicle expenses by its uuid. A record of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `expenses:read`.",
                "summary": "Read an expense",
                "tags": [
                    "Expense"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The expense.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "7e1c4a92-3d58-4f06-a9b3-2b6d8e0f5c14",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                "expense_type_code": "fuel",
                                                "spent_on": "2026-05-12",
                                                "amount_minor": 34250,
                                                "currency": "SAR",
                                                "supplier": "Al Rajhi Fuel Station",
                                                "reference": "INV-20481",
                                                "voided_at": null,
                                                "created_at": "2026-05-12T12:00:00Z",
                                                "updated_at": "2026-05-12T12:00:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "additionalProperties": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/expenses/types/{code}": {
            "put": {
                "operationId": "expenses.types.update",
                "description": "Renames an expense type of your own company or switches it off or on, as the panel does. A type of the platform answers 404, and a type is never deleted. Requires the key scope `fleet:expenses:write`.\n\nRequires the key scope `fleet:expenses:write`.",
                "summary": "Change an expense type",
                "tags": [
                    "ExpenseTypeWrite"
                ],
                "parameters": [
                    {
                        "name": "code",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/ExpenseTypeRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "name_ar": {
                                                "type": "string",
                                                "description": "The name in Arabic, up to 120 characters.",
                                                "examples": [
                                                    "رسوم موقف"
                                                ]
                                            },
                                            "name_en": {
                                                "type": "string",
                                                "description": "The name in English, with no Arabic letters.",
                                                "examples": [
                                                    "Parking fees"
                                                ]
                                            },
                                            "is_active": {
                                                "type": "boolean",
                                                "description": "false to stop offering the type; true by default.",
                                                "examples": [
                                                    true
                                                ]
                                            }
                                        },
                                        "required": [
                                            "name_ar"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The type, changed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "code": "c12_a1b2c3d4",
                                                "name_ar": "رسوم موقف",
                                                "name_en": "Parking fees",
                                                "is_active": true
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "code": {
                                                            "type": "string"
                                                        },
                                                        "name_ar": {
                                                            "type": "string"
                                                        },
                                                        "name_en": {
                                                            "type": "string"
                                                        },
                                                        "is_active": {
                                                            "type": "boolean"
                                                        }
                                                    },
                                                    "required": [
                                                        "code",
                                                        "name_ar",
                                                        "name_en",
                                                        "is_active"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/expenses/{uuid}/void": {
            "post": {
                "operationId": "expenses.void",
                "description": "Voids an expense of your company with a reason of at least ten characters; the row stays, frozen, and is shown as voided. Send the `row_version` you read: an expense changed meanwhile answers 409. An expense that is the payment of a violation cannot be voided here (409): reopen the payment on the violation. Requires the key scope `fleet:expenses:write`.\n\nRequires the key scope `fleet:expenses:write`.",
                "summary": "Void a vehicle expense",
                "tags": [
                    "ExpenseWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/VoidExpenseRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The version of the expense you read.",
                                                "examples": [
                                                    1
                                                ]
                                            },
                                            "reason": {
                                                "type": "string",
                                                "description": "Why it is voided, 10 to 1000 characters of plain text.",
                                                "examples": [
                                                    "Recorded twice by mistake"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version",
                                            "reason"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The expense, now voided.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "7e1c4a92-3d58-4f06-a9b3-2b6d8e0f5c14",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                "expense_type_code": "fuel",
                                                "spent_on": "2026-05-12",
                                                "amount_minor": 34250,
                                                "currency": "SAR",
                                                "supplier": "Al Rajhi Fuel Station",
                                                "reference": "INV-20481",
                                                "voided_at": null,
                                                "created_at": "2026-05-12T12:00:00Z",
                                                "updated_at": "2026-05-12T12:00:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "vehicle_uuid": {
                                                            "type": "string"
                                                        },
                                                        "branch_uuid": {
                                                            "type": "string"
                                                        },
                                                        "expense_type_code": {
                                                            "type": "string"
                                                        },
                                                        "spent_on": {
                                                            "type": "string"
                                                        },
                                                        "amount_minor": {
                                                            "type": "string"
                                                        },
                                                        "currency": {
                                                            "type": "string"
                                                        },
                                                        "supplier": {
                                                            "type": "string"
                                                        },
                                                        "reference": {
                                                            "type": "string"
                                                        },
                                                        "voided_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "vehicle_uuid",
                                                        "branch_uuid",
                                                        "expense_type_code",
                                                        "spent_on",
                                                        "amount_minor",
                                                        "currency",
                                                        "supplier",
                                                        "reference",
                                                        "voided_at",
                                                        "created_at",
                                                        "updated_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/file-imports": {
            "get": {
                "operationId": "file_imports.index",
                "description": "Lists the fleet files your company uploaded, oldest first, one page at a time: the kind of record, the file name, how many rows were staged and the skipped rows with a closed reason each. Nothing from inside a file is returned. Needs the same right as the uploads page.\n\nRequires the key scope `file_imports:read`.",
                "summary": "List fleet file uploads",
                "tags": [
                    "FileImport"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only uploads of this kind of record: vehicle, driver or device.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "vehicle"
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only uploads made at or after this moment (ISO 8601 with an offset).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of uploads.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "4d8b2f70-1c5e-4a96-b3d7-6e0a9c2f5b18",
                                                    "record_type": "vehicle",
                                                    "file_name": "vehicles.xlsx",
                                                    "rows_staged": 38,
                                                    "rows_skipped": 2,
                                                    "skipped": [
                                                        {
                                                            "row": 7,
                                                            "reason": "no_identifier"
                                                        },
                                                        {
                                                            "row": 19,
                                                            "reason": "invalid_values"
                                                        }
                                                    ],
                                                    "retries": 0,
                                                    "created_at": "2026-11-14T08:30:00Z",
                                                    "last_retried_at": null
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-14T12:00:00Z",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/file-imports/{uuid}": {
            "get": {
                "operationId": "file_imports.show",
                "description": "Reads one upload by its uuid. Another company's upload answers 404 exactly like one that does not exist.\n\nRequires the key scope `file_imports:read`.",
                "summary": "Read a fleet file upload",
                "tags": [
                    "FileImport"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The upload.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "4d8b2f70-1c5e-4a96-b3d7-6e0a9c2f5b18",
                                                "record_type": "vehicle",
                                                "file_name": "vehicles.xlsx",
                                                "rows_staged": 38,
                                                "rows_skipped": 2,
                                                "skipped": [
                                                    {
                                                        "row": 7,
                                                        "reason": "no_identifier"
                                                    },
                                                    {
                                                        "row": 19,
                                                        "reason": "invalid_values"
                                                    }
                                                ],
                                                "retries": 0,
                                                "created_at": "2026-11-14T08:30:00Z",
                                                "last_retried_at": null
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-14T12:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "additionalProperties": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/fitted-items": {
            "get": {
                "operationId": "fitted_items.index",
                "description": "Lists your company's fitted tyres and batteries, oldest first, one page at a time. Each carries the vehicle by uuid, the kind, brand, size, position, the dates and kilometres of fitting and removal, and the reason a removed one ended. The cost, the notes and who entered them are never shown.\n\nRequires the key scope `fitted_items:read`.",
                "summary": "List fitted tyres and batteries",
                "tags": [
                    "FittedItem"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only items in this state: active or voided. Voided items are left out unless you ask for them.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "voided"
                    },
                    {
                        "name": "vehicle",
                        "in": "query",
                        "description": "Only the items of this vehicle (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only items changed at or after this moment (ISO 8601 with an offset, e.g. 2026-05-01T00:00:00Z).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of fitted tyres and batteries.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "3a8e1c52-7b40-4d19-9f6e-2c5d0b8a7e31",
                                                    "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                    "asset_uuid": null,
                                                    "kind": "tyre",
                                                    "brand": "Michelin",
                                                    "model": "XZE",
                                                    "specification": "315/80R22.5",
                                                    "serial_number": "DOT-2024-0113",
                                                    "condition": "new",
                                                    "placement": "wheel",
                                                    "axle": 1,
                                                    "side": "left",
                                                    "slot": 1,
                                                    "fitted_on": "2026-03-02",
                                                    "fitted_km": 85000,
                                                    "removed_on": null,
                                                    "removed_km": null,
                                                    "removal_reason": null,
                                                    "voided_at": null,
                                                    "created_at": "2026-03-02T08:00:00Z",
                                                    "updated_at": "2026-03-02T08:00:00Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:30:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "post": {
                "operationId": "fitted_items.fit",
                "description": "Records a tyre or a battery fitted to one of your company's vehicles, as the panel does: what it is, the place and the day. A cost is never accepted here; it stays in the panel. Requires the key scope `fleet:fitted_items:write` and a plan with maintenance.\n\nRequires the key scope `fleet:fitted_items:write`.",
                "summary": "Fit a tyre or a battery",
                "tags": [
                    "FittedItemWrite"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/FitItemRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "vehicle": {
                                                "type": "string",
                                                "format": "uuid",
                                                "description": "The vehicle, by its uuid; send this or `asset`, not both.",
                                                "examples": [
                                                    "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11"
                                                ]
                                            },
                                            "asset": {
                                                "type": "string",
                                                "format": "uuid",
                                                "description": "The trailer or the equipment, by its uuid; it has no odometer, so no kilometres are accepted.",
                                                "examples": [
                                                    "5d2c8f10-3b7e-4a64-8e0d-91f4c7a2b3e6"
                                                ]
                                            },
                                            "kind": {
                                                "type": "string",
                                                "description": "tyre or battery.",
                                                "examples": [
                                                    "tyre"
                                                ]
                                            },
                                            "brand": {
                                                "type": "string",
                                                "description": "The brand.",
                                                "examples": [
                                                    "Michelin"
                                                ]
                                            },
                                            "specification": {
                                                "type": "string",
                                                "description": "The tyre size or the battery specification.",
                                                "examples": [
                                                    "315/80R22.5"
                                                ]
                                            },
                                            "fitted_on": {
                                                "type": "string",
                                                "description": "The fitting day, YYYY-MM-DD.",
                                                "examples": [
                                                    "2026-03-02"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "kind",
                                            "brand",
                                            "specification",
                                            "fitted_on"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The fitted item.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "3a8e1c52-7b40-4d19-9f6e-2c5d0b8a7e31",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "asset_uuid": null,
                                                "kind": "tyre",
                                                "brand": "Michelin",
                                                "model": "XZE",
                                                "specification": "315/80R22.5",
                                                "serial_number": "DOT-2024-0113",
                                                "condition": "new",
                                                "placement": "wheel",
                                                "axle": 1,
                                                "side": "left",
                                                "slot": 1,
                                                "fitted_on": "2026-03-02",
                                                "fitted_km": 85000,
                                                "removed_on": null,
                                                "removed_km": null,
                                                "removal_reason": null,
                                                "voided_at": null,
                                                "created_at": "2026-03-02T08:00:00Z",
                                                "updated_at": "2026-03-02T08:00:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uuid": {
                                                    "type": "string"
                                                },
                                                "vehicle_uuid": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "asset_uuid": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "kind": {
                                                    "type": "string"
                                                },
                                                "brand": {
                                                    "type": "string"
                                                },
                                                "model": {
                                                    "type": "string"
                                                },
                                                "specification": {
                                                    "type": "string"
                                                },
                                                "serial_number": {
                                                    "type": "string"
                                                },
                                                "condition": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "placement": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "axle": {
                                                    "type": "string"
                                                },
                                                "side": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "enum": [
                                                        "left",
                                                        "right",
                                                        null
                                                    ]
                                                },
                                                "slot": {
                                                    "type": "string"
                                                },
                                                "fitted_on": {
                                                    "type": "string"
                                                },
                                                "fitted_km": {
                                                    "type": "string"
                                                },
                                                "removed_on": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "removed_km": {
                                                    "type": "string"
                                                },
                                                "removal_reason": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "voided_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "uuid",
                                                "vehicle_uuid",
                                                "asset_uuid",
                                                "kind",
                                                "brand",
                                                "model",
                                                "specification",
                                                "serial_number",
                                                "condition",
                                                "placement",
                                                "axle",
                                                "side",
                                                "slot",
                                                "fitted_on",
                                                "fitted_km",
                                                "removed_on",
                                                "removed_km",
                                                "removal_reason",
                                                "voided_at",
                                                "created_at",
                                                "updated_at"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/fitted-items/{uuid}": {
            "get": {
                "operationId": "fitted_items.show",
                "description": "Reads one of your company's fitted tyres or batteries by its uuid. A record of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `fitted_items:read`.",
                "summary": "Read a fitted tyre or battery",
                "tags": [
                    "FittedItem"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The fitted item.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "3a8e1c52-7b40-4d19-9f6e-2c5d0b8a7e31",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "asset_uuid": null,
                                                "kind": "tyre",
                                                "brand": "Michelin",
                                                "model": "XZE",
                                                "specification": "315/80R22.5",
                                                "serial_number": "DOT-2024-0113",
                                                "condition": "new",
                                                "placement": "wheel",
                                                "axle": 1,
                                                "side": "left",
                                                "slot": 1,
                                                "fitted_on": "2026-03-02",
                                                "fitted_km": 85000,
                                                "removed_on": null,
                                                "removed_km": null,
                                                "removal_reason": null,
                                                "voided_at": null,
                                                "created_at": "2026-03-02T08:00:00Z",
                                                "updated_at": "2026-03-02T08:00:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:30:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "additionalProperties": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/fitted-items/rotate": {
            "post": {
                "operationId": "fitted_items.rotate",
                "description": "Moves tyres of one vehicle to new places at once, a swap included. Each move names the tyre, the version you read and the new place. A tyre changed meanwhile answers 409. Requires the key scope `fleet:fitted_items:write`.\n\nRequires the key scope `fleet:fitted_items:write`.",
                "summary": "Rotate tyres",
                "tags": [
                    "FittedItemWrite"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/RotateItemsRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "vehicle": {
                                                "type": "string",
                                                "format": "uuid",
                                                "description": "The vehicle, by its uuid; send this or `asset`, not both.",
                                                "examples": [
                                                    "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11"
                                                ]
                                            },
                                            "asset": {
                                                "type": "string",
                                                "format": "uuid",
                                                "description": "The trailer or the equipment, by its uuid.",
                                                "examples": [
                                                    "5d2c8f10-3b7e-4a64-8e0d-91f4c7a2b3e6"
                                                ]
                                            },
                                            "occurred_on": {
                                                "type": "string",
                                                "description": "The day of the rotation, YYYY-MM-DD.",
                                                "examples": [
                                                    "2026-05-12"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "occurred_on"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The moved tyres.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "3a8e1c52-7b40-4d19-9f6e-2c5d0b8a7e31",
                                                    "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                    "asset_uuid": null,
                                                    "kind": "tyre",
                                                    "brand": "Michelin",
                                                    "model": "XZE",
                                                    "specification": "315/80R22.5",
                                                    "serial_number": "DOT-2024-0113",
                                                    "condition": "new",
                                                    "placement": "wheel",
                                                    "axle": 1,
                                                    "side": "left",
                                                    "slot": 1,
                                                    "fitted_on": "2026-03-02",
                                                    "fitted_km": 85000,
                                                    "removed_on": null,
                                                    "removed_km": null,
                                                    "removal_reason": null,
                                                    "voided_at": null,
                                                    "created_at": "2026-03-02T08:00:00Z",
                                                    "updated_at": "2026-03-02T08:00:00Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": []
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/fitted-items/{uuid}/check": {
            "post": {
                "operationId": "fitted_items.check",
                "description": "Records one reading on a fitted item: a tyre's tread in millimetres or pressure in bar, or a battery's voltage in volts, with the day and optionally the odometer. Send exactly one reading. Requires the key scope `fleet:fitted_items:write`.\n\nRequires the key scope `fleet:fitted_items:write`.",
                "summary": "Record a reading of a tyre or a battery",
                "tags": [
                    "FittedItemWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/CheckItemRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "occurred_on": {
                                                "type": "string",
                                                "description": "The day of the reading, YYYY-MM-DD.",
                                                "examples": [
                                                    "2026-05-12"
                                                ]
                                            },
                                            "pressure_bar": {
                                                "type": "object",
                                                "description": "A tyre's pressure in bar.",
                                                "examples": [
                                                    8.5
                                                ]
                                            }
                                        },
                                        "required": [
                                            "occurred_on"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The fitted item.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "3a8e1c52-7b40-4d19-9f6e-2c5d0b8a7e31",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "asset_uuid": null,
                                                "kind": "tyre",
                                                "brand": "Michelin",
                                                "model": "XZE",
                                                "specification": "315/80R22.5",
                                                "serial_number": "DOT-2024-0113",
                                                "condition": "new",
                                                "placement": "wheel",
                                                "axle": 1,
                                                "side": "left",
                                                "slot": 1,
                                                "fitted_on": "2026-03-02",
                                                "fitted_km": 85000,
                                                "removed_on": null,
                                                "removed_km": null,
                                                "removal_reason": null,
                                                "voided_at": null,
                                                "created_at": "2026-03-02T08:00:00Z",
                                                "updated_at": "2026-03-02T08:00:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "vehicle_uuid": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "asset_uuid": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "kind": {
                                                            "type": "string"
                                                        },
                                                        "brand": {
                                                            "type": "string"
                                                        },
                                                        "model": {
                                                            "type": "string"
                                                        },
                                                        "specification": {
                                                            "type": "string"
                                                        },
                                                        "serial_number": {
                                                            "type": "string"
                                                        },
                                                        "condition": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "placement": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "axle": {
                                                            "type": "string"
                                                        },
                                                        "side": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "enum": [
                                                                "left",
                                                                "right",
                                                                null
                                                            ]
                                                        },
                                                        "slot": {
                                                            "type": "string"
                                                        },
                                                        "fitted_on": {
                                                            "type": "string"
                                                        },
                                                        "fitted_km": {
                                                            "type": "string"
                                                        },
                                                        "removed_on": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "removed_km": {
                                                            "type": "string"
                                                        },
                                                        "removal_reason": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "voided_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "vehicle_uuid",
                                                        "asset_uuid",
                                                        "kind",
                                                        "brand",
                                                        "model",
                                                        "specification",
                                                        "serial_number",
                                                        "condition",
                                                        "placement",
                                                        "axle",
                                                        "side",
                                                        "slot",
                                                        "fitted_on",
                                                        "fitted_km",
                                                        "removed_on",
                                                        "removed_km",
                                                        "removal_reason",
                                                        "voided_at",
                                                        "created_at",
                                                        "updated_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/fitted-items/{uuid}/remove": {
            "post": {
                "operationId": "fitted_items.remove",
                "description": "Records the removal of a fitted item, as the panel does: the day, the reason and optionally a note, the odometer and the last tread. Send the `row_version` you read: an item changed meanwhile answers 409. Voiding an item stays in the panel. Requires the key scope `fleet:fitted_items:write`.\n\nRequires the key scope `fleet:fitted_items:write`.",
                "summary": "Take a tyre or a battery off",
                "tags": [
                    "FittedItemWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/RemoveItemRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The version of the item you read.",
                                                "examples": [
                                                    1
                                                ]
                                            },
                                            "removed_on": {
                                                "type": "string",
                                                "description": "The removal day, YYYY-MM-DD.",
                                                "examples": [
                                                    "2026-05-12"
                                                ]
                                            },
                                            "reason": {
                                                "type": "string",
                                                "description": "worn_out, damaged, failed, aged, warranty, sold_or_scrapped or other (other needs a note).",
                                                "examples": [
                                                    "worn_out"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version",
                                            "removed_on",
                                            "reason"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The removed item.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "3a8e1c52-7b40-4d19-9f6e-2c5d0b8a7e31",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "asset_uuid": null,
                                                "kind": "tyre",
                                                "brand": "Michelin",
                                                "model": "XZE",
                                                "specification": "315/80R22.5",
                                                "serial_number": "DOT-2024-0113",
                                                "condition": "new",
                                                "placement": "wheel",
                                                "axle": 1,
                                                "side": "left",
                                                "slot": 1,
                                                "fitted_on": "2026-03-02",
                                                "fitted_km": 85000,
                                                "removed_on": null,
                                                "removed_km": null,
                                                "removal_reason": null,
                                                "voided_at": null,
                                                "created_at": "2026-03-02T08:00:00Z",
                                                "updated_at": "2026-03-02T08:00:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "vehicle_uuid": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "asset_uuid": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "kind": {
                                                            "type": "string"
                                                        },
                                                        "brand": {
                                                            "type": "string"
                                                        },
                                                        "model": {
                                                            "type": "string"
                                                        },
                                                        "specification": {
                                                            "type": "string"
                                                        },
                                                        "serial_number": {
                                                            "type": "string"
                                                        },
                                                        "condition": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "placement": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "axle": {
                                                            "type": "string"
                                                        },
                                                        "side": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "enum": [
                                                                "left",
                                                                "right",
                                                                null
                                                            ]
                                                        },
                                                        "slot": {
                                                            "type": "string"
                                                        },
                                                        "fitted_on": {
                                                            "type": "string"
                                                        },
                                                        "fitted_km": {
                                                            "type": "string"
                                                        },
                                                        "removed_on": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "removed_km": {
                                                            "type": "string"
                                                        },
                                                        "removal_reason": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "voided_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "vehicle_uuid",
                                                        "asset_uuid",
                                                        "kind",
                                                        "brand",
                                                        "model",
                                                        "specification",
                                                        "serial_number",
                                                        "condition",
                                                        "placement",
                                                        "axle",
                                                        "side",
                                                        "slot",
                                                        "fitted_on",
                                                        "fitted_km",
                                                        "removed_on",
                                                        "removed_km",
                                                        "removal_reason",
                                                        "voided_at",
                                                        "created_at",
                                                        "updated_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/fleet-asset-categories": {
            "get": {
                "operationId": "fleet_asset_categories.index",
                "description": "Lists the active trailer and equipment categories by code, one page at a time, each with its kind.\n\nRequires the key scope `fleet_assets:read`.",
                "summary": "List fleet asset categories",
                "tags": [
                    "FleetAssetCategory"
                ],
                "parameters": [
                    {
                        "name": "kind",
                        "in": "query",
                        "description": "Only the categories of this kind.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "trailer"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of categories.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "code": "flatbed_trailer",
                                                    "kind": "trailer",
                                                    "class_code": "trailer",
                                                    "name_ar": "مقطورة مسطحة",
                                                    "name_en": "Flatbed trailer"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "string"
                                            }
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/fleet-assets/{uuid}/files/{fileUuid}": {
            "get": {
                "operationId": "fleet_assets.files.show",
                "description": "One file of an asset with a short-lived signed link that opens it for the key's owner, who must hold the right to view assets.\n\nRequires the key scope `fleet_assets:read`.",
                "summary": "Open a fleet asset file",
                "tags": [
                    "FleetAssetFile"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "fileUuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The file and its link.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "5d1c8a47-2e93-4b6f-9a10-3c7e5f9b2d64",
                                                "kind": "insurance",
                                                "attached_on": "2026-11-01",
                                                "expires_on": "2027-11-01",
                                                "url": "https://example.test/documents/signed/abc"
                                            },
                                            "error": null,
                                            "meta": []
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "kind": {
                                                            "type": "string"
                                                        },
                                                        "attached_on": {
                                                            "type": "string"
                                                        },
                                                        "expires_on": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "url": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "kind",
                                                        "attached_on",
                                                        "expires_on",
                                                        "url"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "type": "string"
                                                        },
                                                        "timestamp": {
                                                            "type": "string"
                                                        },
                                                        "timezone": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "timezone"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/fleet-assets/{uuid}/maintenance-plans": {
            "get": {
                "operationId": "fleet_assets.maintenance_plans",
                "description": "The maintenance plans of one of your trailers or pieces of equipment, oldest first, at most 100, with the next due day or hours of each active plan. Needs fleet_assets:read and maintenance:read. An asset of another company or branch answers 404.\n\nRequires the key scope `fleet_assets:read,maintenance:read`.",
                "summary": "Read a fleet asset's maintenance plans",
                "tags": [
                    "FleetAssetPlan"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The plans.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "asset_uuid": "9e2b7c14-3d58-4f0a-b6a1-7c4d2e8f5a10",
                                                "plans": [
                                                    {
                                                        "uuid": "8b4e3f2a-6d7c-4b90-9e21-3c5d7f9a1b44",
                                                        "name": "Brake service",
                                                        "plan_type": "preventive",
                                                        "category_code": null,
                                                        "every_days": 180,
                                                        "every_hours": null,
                                                        "baseline_on": "2026-06-01",
                                                        "baseline_hours": null,
                                                        "status": "active",
                                                        "due_state": "ok",
                                                        "next_due_on": "2026-11-28",
                                                        "days_left": 13,
                                                        "next_due_hours": null,
                                                        "hours_left": null
                                                    }
                                                ]
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-15T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "asset_uuid": {
                                                            "type": "string"
                                                        },
                                                        "plans": {
                                                            "type": "array",
                                                            "items": {
                                                                "type": "string"
                                                            }
                                                        }
                                                    },
                                                    "required": [
                                                        "asset_uuid",
                                                        "plans"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "type": "string"
                                                        },
                                                        "timestamp": {
                                                            "type": "string"
                                                        },
                                                        "timezone": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "timezone"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/fleet-assets/{uuid}/warranties": {
            "get": {
                "operationId": "fleet_assets.warranties",
                "description": "The warranties of one of your trailers or pieces of equipment that were not voided, the one ending last first. An asset of another company or branch answers 404.\n\nRequires the key scope `fleet_assets:read`.",
                "summary": "Read a fleet asset's warranties",
                "tags": [
                    "FleetAssetWarranty"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The warranties.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "asset_uuid": "9e2b7c14-3d58-4f0a-b6a1-7c4d2e8f5a10",
                                                "warranties": [
                                                    {
                                                        "uuid": "7a3d2e1f-5c6b-4a89-8d10-2b4c6e8f0a33",
                                                        "coverage": "Axles and brakes",
                                                        "provider_name": "Trailer Works Co",
                                                        "reference": "W-2026-118",
                                                        "starts_on": "2026-01-01",
                                                        "expires_on": "2027-12-31",
                                                        "expired": false
                                                    }
                                                ]
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-15T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "asset_uuid": {
                                                            "type": "string"
                                                        },
                                                        "warranties": {
                                                            "type": "array",
                                                            "items": {
                                                                "type": "string"
                                                            }
                                                        }
                                                    },
                                                    "required": [
                                                        "asset_uuid",
                                                        "warranties"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "type": "string"
                                                        },
                                                        "timestamp": {
                                                            "type": "string"
                                                        },
                                                        "timezone": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "timezone"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/reports/fleet-profitability": {
            "get": {
                "operationId": "reports.fleet_profitability",
                "description": "The figures of the fleet profitability page for the last 7, 30 or 90 Saudi days against the days just before or the same days a year earlier: revenue, cost, profit and margin with their moves, the profit week by week, where the cost went by kind, the vehicles that made the most and the least, the health of the trips closed in the period with the biggest losses and the reasons the records give for them, and the profit of each lane for each kilometre. Money is a list of lines, one per currency, never added across currencies; a figure that needs one currency is null when there are several. The kinds of cost and the trip health follow what the key owner may see, and no driver is named. Requires the key scope `reporting:fleet_profitability:read`.\n\nRequires the key scope `reporting:fleet_profitability:read`.",
                "summary": "Read the fleet profitability figures",
                "tags": [
                    "FleetProfitability"
                ],
                "parameters": [
                    {
                        "name": "days",
                        "in": "query",
                        "description": "The period: the last 7, 30 or 90 days up to and including today; 30 when absent.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "compare",
                        "in": "query",
                        "description": "What the period is compared with: previous (the days just before it) or year_before (the same days a year earlier); previous when absent.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The figures of the period.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "period": {
                                                    "from": "2026-10-20",
                                                    "until": "2026-11-18",
                                                    "days": 30,
                                                    "compare": "previous"
                                                },
                                                "currency": "SAR",
                                                "now": {
                                                    "revenue": [
                                                        {
                                                            "currency": "SAR",
                                                            "amount": "120000.00"
                                                        }
                                                    ],
                                                    "cost": [
                                                        {
                                                            "currency": "SAR",
                                                            "amount": "70000.00"
                                                        }
                                                    ],
                                                    "profit": [
                                                        {
                                                            "currency": "SAR",
                                                            "amount": "50000.00"
                                                        }
                                                    ],
                                                    "margin_basis_points": 4167
                                                },
                                                "before": {
                                                    "revenue": [
                                                        {
                                                            "currency": "SAR",
                                                            "amount": "100000.00"
                                                        }
                                                    ],
                                                    "cost": [
                                                        {
                                                            "currency": "SAR",
                                                            "amount": "65000.00"
                                                        }
                                                    ],
                                                    "profit": [
                                                        {
                                                            "currency": "SAR",
                                                            "amount": "35000.00"
                                                        }
                                                    ],
                                                    "margin_basis_points": 3500
                                                },
                                                "change": {
                                                    "revenue_basis_points": 2000,
                                                    "cost_basis_points": 769,
                                                    "profit_basis_points": 4286,
                                                    "margin_move_basis_points": 667
                                                },
                                                "weeks": [],
                                                "cost_kinds": {
                                                    "now": [],
                                                    "before": []
                                                },
                                                "vehicles": null,
                                                "trip_health": {
                                                    "reason": "no_trips"
                                                },
                                                "lanes": null,
                                                "attention": []
                                            },
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-19T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "period": {
                                                            "type": "object",
                                                            "properties": {
                                                                "from": {
                                                                    "type": "string"
                                                                },
                                                                "until": {
                                                                    "type": "string"
                                                                },
                                                                "days": {
                                                                    "type": "integer"
                                                                },
                                                                "compare": {
                                                                    "type": "string"
                                                                }
                                                            },
                                                            "required": [
                                                                "from",
                                                                "until",
                                                                "days",
                                                                "compare"
                                                            ]
                                                        },
                                                        "currency": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "now": {
                                                            "type": "object",
                                                            "properties": {
                                                                "revenue": {
                                                                    "type": "array",
                                                                    "items": []
                                                                },
                                                                "cost": {
                                                                    "type": "array",
                                                                    "items": []
                                                                },
                                                                "profit": {
                                                                    "type": "array",
                                                                    "items": []
                                                                },
                                                                "margin_basis_points": {
                                                                    "type": [
                                                                        "integer",
                                                                        "null"
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "revenue",
                                                                "cost",
                                                                "profit",
                                                                "margin_basis_points"
                                                            ]
                                                        },
                                                        "before": {
                                                            "type": "object",
                                                            "properties": {
                                                                "revenue": {
                                                                    "type": "array",
                                                                    "items": []
                                                                },
                                                                "cost": {
                                                                    "type": "array",
                                                                    "items": []
                                                                },
                                                                "profit": {
                                                                    "type": "array",
                                                                    "items": []
                                                                },
                                                                "margin_basis_points": {
                                                                    "type": [
                                                                        "integer",
                                                                        "null"
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "revenue",
                                                                "cost",
                                                                "profit",
                                                                "margin_basis_points"
                                                            ]
                                                        },
                                                        "change": {
                                                            "type": "object",
                                                            "properties": {
                                                                "revenue_basis_points": {
                                                                    "type": [
                                                                        "integer",
                                                                        "null"
                                                                    ]
                                                                },
                                                                "cost_basis_points": {
                                                                    "type": [
                                                                        "integer",
                                                                        "null"
                                                                    ]
                                                                },
                                                                "profit_basis_points": {
                                                                    "type": [
                                                                        "integer",
                                                                        "null"
                                                                    ]
                                                                },
                                                                "margin_move_basis_points": {
                                                                    "type": [
                                                                        "integer",
                                                                        "null"
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "revenue_basis_points",
                                                                "cost_basis_points",
                                                                "profit_basis_points",
                                                                "margin_move_basis_points"
                                                            ]
                                                        },
                                                        "weeks": {
                                                            "type": [
                                                                "array",
                                                                "null"
                                                            ],
                                                            "items": []
                                                        },
                                                        "cost_kinds": {
                                                            "type": [
                                                                "object",
                                                                "null"
                                                            ],
                                                            "properties": {
                                                                "now": {
                                                                    "type": "array",
                                                                    "items": []
                                                                },
                                                                "before": {
                                                                    "type": "array",
                                                                    "items": []
                                                                }
                                                            },
                                                            "required": [
                                                                "now",
                                                                "before"
                                                            ]
                                                        },
                                                        "vehicles": {
                                                            "type": [
                                                                "object",
                                                                "null"
                                                            ],
                                                            "properties": {
                                                                "currency": {
                                                                    "type": "string"
                                                                },
                                                                "top": {
                                                                    "type": "array",
                                                                    "items": []
                                                                },
                                                                "bottom": {
                                                                    "type": "array",
                                                                    "items": []
                                                                },
                                                                "read": {
                                                                    "type": "integer"
                                                                },
                                                                "total": {
                                                                    "type": "integer"
                                                                }
                                                            },
                                                            "required": [
                                                                "currency",
                                                                "top",
                                                                "bottom",
                                                                "read",
                                                                "total"
                                                            ]
                                                        },
                                                        "trip_health": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "reason": {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "reason"
                                                                    ]
                                                                },
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "currency": {
                                                                            "type": "string"
                                                                        },
                                                                        "breakeven_percent": {
                                                                            "type": "integer"
                                                                        },
                                                                        "profitable": {
                                                                            "type": "integer"
                                                                        },
                                                                        "breakeven": {
                                                                            "type": "integer"
                                                                        },
                                                                        "losing": {
                                                                            "type": "integer"
                                                                        },
                                                                        "unjudged": {
                                                                            "type": "integer"
                                                                        },
                                                                        "profit": {
                                                                            "type": "string"
                                                                        },
                                                                        "loss": {
                                                                            "type": "string"
                                                                        },
                                                                        "read": {
                                                                            "type": "integer"
                                                                        },
                                                                        "total": {
                                                                            "type": "integer"
                                                                        },
                                                                        "biggest_losses": {
                                                                            "type": "array",
                                                                            "items": []
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "currency",
                                                                        "breakeven_percent",
                                                                        "profitable",
                                                                        "breakeven",
                                                                        "losing",
                                                                        "unjudged",
                                                                        "profit",
                                                                        "loss",
                                                                        "read",
                                                                        "total",
                                                                        "biggest_losses"
                                                                    ]
                                                                }
                                                            ]
                                                        },
                                                        "lanes": {
                                                            "type": [
                                                                "object",
                                                                "null"
                                                            ],
                                                            "properties": {
                                                                "currency": {
                                                                    "type": "string"
                                                                },
                                                                "judged_trips": {
                                                                    "type": "integer"
                                                                },
                                                                "without_distance": {
                                                                    "type": "integer"
                                                                },
                                                                "is_cut": {
                                                                    "type": "boolean"
                                                                },
                                                                "lanes": {
                                                                    "type": "array",
                                                                    "items": []
                                                                }
                                                            },
                                                            "required": [
                                                                "currency",
                                                                "judged_trips",
                                                                "without_distance",
                                                                "is_cut",
                                                                "lanes"
                                                            ]
                                                        },
                                                        "attention": {
                                                            "type": "array",
                                                            "items": []
                                                        }
                                                    },
                                                    "required": [
                                                        "period",
                                                        "currency",
                                                        "now",
                                                        "before",
                                                        "change",
                                                        "weeks",
                                                        "cost_kinds",
                                                        "vehicles",
                                                        "trip_health",
                                                        "lanes",
                                                        "attention"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "type": "string"
                                                        },
                                                        "timestamp": {
                                                            "type": "string"
                                                        },
                                                        "timezone": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "timezone"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/fleet/search": {
            "get": {
                "operationId": "fleet.search",
                "description": "Finds your vehicles, maintenance work orders, spare parts, defects and fleet assets by the text the panel's top search uses, up to 10 of each kind: for every hit its type, its uuid and a short label, nothing else. A kind appears only when your key's owner may list it and your key also holds its own read scope (`vehicles:read`, `maintenance:read`, `defects:read` or `fleet_assets:read`); a key limited to a branch finds that branch's records only. Drivers, money records and personal data are never searched. The text is 2 to 60 characters. Requires the key scope `fleet:search:read`.\n\nRequires the key scope `fleet:search:read`.",
                "summary": "Search the fleet records",
                "tags": [
                    "FleetSearch"
                ],
                "parameters": [
                    {
                        "name": "q",
                        "in": "query",
                        "required": true,
                        "description": "The text to find, 2 to 60 characters of plain text.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "ABC"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The hits, grouped by nothing: each carries its type.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "type": "vehicle",
                                                    "uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                    "label": "ABC 1234"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "type": {
                                                        "type": "string"
                                                    },
                                                    "uuid": {
                                                        "type": "string"
                                                    },
                                                    "label": {
                                                        "type": "string"
                                                    }
                                                },
                                                "required": [
                                                    "type",
                                                    "uuid",
                                                    "label"
                                                ]
                                            }
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/fuel-cards": {
            "get": {
                "operationId": "fuel_cards.index",
                "description": "Lists your company's fuel cards, oldest first, one page at a time. Each carries the provider, the last four digits only, the state, the vehicle and the driver by uuid and the monthly limit. The card number and the note are never part of it.\n\nRequires the key scope `fuel_cards:read`.",
                "summary": "List fuel cards",
                "tags": [
                    "FuelCard"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only cards in this state: active, stopped or lost.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "active"
                    },
                    {
                        "name": "vehicle",
                        "in": "query",
                        "description": "Only the cards held by this vehicle (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "driver",
                        "in": "query",
                        "description": "Only the cards held by this driver (their uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "branch",
                        "in": "query",
                        "description": "Only cards of this branch (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only cards changed at or after this moment (ISO 8601 with an offset, e.g. 2026-05-01T00:00:00Z).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of fuel cards.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "3b7e5a92-1c4d-4e68-9f03-7a2d8c6b1e45",
                                                    "provider": "Aldrees",
                                                    "label": "Truck 12 card",
                                                    "last4": "4821",
                                                    "state": "active",
                                                    "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                    "driver_uuid": null,
                                                    "monthly_limit": "5000.00",
                                                    "currency": "SAR",
                                                    "expires_month": "2028-03",
                                                    "row_version": 1,
                                                    "created_at": "2026-05-12T09:20:00Z",
                                                    "updated_at": "2026-05-12T09:20:00Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:30:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "post": {
                "operationId": "fuel_cards.create",
                "description": "Adds a fuel card of your company, as the panel does: the provider and the last four digits only. The full number is refused and never saved. A holder is a vehicle or a driver of your company, by uuid; one you may not see answers like one that does not exist. A note is not accepted here. At most 20 cards an hour for one key.\n\nRequires the key scope `fleet:fuel_cards:write`.",
                "summary": "Add a fuel card",
                "tags": [
                    "FuelCardWrite"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/CreateFuelCardRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "provider": {
                                                "type": "string",
                                                "description": "The card provider, up to 60 characters of plain text.",
                                                "examples": [
                                                    "Aldrees"
                                                ]
                                            },
                                            "last4": {
                                                "type": "string",
                                                "description": "The last four digits of the card, four digits only.",
                                                "examples": [
                                                    "4821"
                                                ]
                                            },
                                            "label": {
                                                "type": "string",
                                                "description": "A name for the card, up to 60 characters.",
                                                "examples": [
                                                    "Truck 12 card"
                                                ]
                                            },
                                            "vehicle": {
                                                "type": "string",
                                                "format": "uuid",
                                                "description": "The vehicle that holds it, by uuid."
                                            },
                                            "driver": {
                                                "type": "string",
                                                "format": "uuid",
                                                "description": "The driver that holds it, by uuid."
                                            },
                                            "monthly_limit": {
                                                "type": "string",
                                                "description": "The monthly limit as a decimal amount.",
                                                "examples": [
                                                    "5000.00"
                                                ]
                                            },
                                            "currency": {
                                                "type": "string",
                                                "description": "The currency code of the limit, required with it.",
                                                "examples": [
                                                    "SAR"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "provider",
                                            "last4"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The fuel card that was added.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "3b7e5a92-1c4d-4e68-9f03-7a2d8c6b1e45",
                                                "provider": "Aldrees",
                                                "label": "Truck 12 card",
                                                "last4": "4821",
                                                "state": "active",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "driver_uuid": null,
                                                "monthly_limit": "5000.00",
                                                "currency": "SAR",
                                                "expires_month": "2028-03",
                                                "row_version": 1,
                                                "created_at": "2026-05-12T09:20:00Z",
                                                "updated_at": "2026-05-12T09:20:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uuid": {
                                                    "type": "string"
                                                },
                                                "provider": {
                                                    "type": "string"
                                                },
                                                "label": {
                                                    "type": "string"
                                                },
                                                "last4": {
                                                    "type": "string"
                                                },
                                                "state": {
                                                    "type": "string"
                                                },
                                                "vehicle_uuid": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "driver_uuid": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "monthly_limit": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "currency": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "expires_month": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "row_version": {
                                                    "type": "string"
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "uuid",
                                                "provider",
                                                "label",
                                                "last4",
                                                "state",
                                                "vehicle_uuid",
                                                "driver_uuid",
                                                "monthly_limit",
                                                "currency",
                                                "expires_month",
                                                "row_version",
                                                "created_at",
                                                "updated_at"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/fuel-cards/{uuid}": {
            "get": {
                "operationId": "fuel_cards.show",
                "description": "Reads one of your company's fuel cards by its uuid. A card of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `fuel_cards:read`.",
                "summary": "Read a fuel card",
                "tags": [
                    "FuelCard"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The fuel card.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "3b7e5a92-1c4d-4e68-9f03-7a2d8c6b1e45",
                                                "provider": "Aldrees",
                                                "label": "Truck 12 card",
                                                "last4": "4821",
                                                "state": "active",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "driver_uuid": null,
                                                "monthly_limit": "5000.00",
                                                "currency": "SAR",
                                                "expires_month": "2028-03",
                                                "row_version": 1,
                                                "created_at": "2026-05-12T09:20:00Z",
                                                "updated_at": "2026-05-12T09:20:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:30:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "additionalProperties": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/fuel-cards/{uuid}/assign": {
            "post": {
                "operationId": "fuel_cards.assign",
                "description": "Changes who holds an active card: a vehicle, a driver or both by uuid, or neither to unassign it. Send the `row_version` you read; a card changed meanwhile answers 409. A stopped or lost card cannot change holder (422).\n\nRequires the key scope `fleet:fuel_cards:write`.",
                "summary": "Change the holder of a fuel card",
                "tags": [
                    "FuelCardWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/AssignFuelCardRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The version of the card you read.",
                                                "examples": [
                                                    1
                                                ]
                                            },
                                            "vehicle": {
                                                "type": "string",
                                                "format": "uuid",
                                                "description": "The vehicle that holds it, by uuid, or null."
                                            },
                                            "driver": {
                                                "type": "string",
                                                "format": "uuid",
                                                "description": "The driver that holds it, by uuid, or null."
                                            }
                                        },
                                        "required": [
                                            "row_version"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The fuel card with its new holder.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "3b7e5a92-1c4d-4e68-9f03-7a2d8c6b1e45",
                                                "provider": "Aldrees",
                                                "label": "Truck 12 card",
                                                "last4": "4821",
                                                "state": "active",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "driver_uuid": null,
                                                "monthly_limit": "5000.00",
                                                "currency": "SAR",
                                                "expires_month": "2028-03",
                                                "row_version": 1,
                                                "created_at": "2026-05-12T09:20:00Z",
                                                "updated_at": "2026-05-12T09:20:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "provider": {
                                                            "type": "string"
                                                        },
                                                        "label": {
                                                            "type": "string"
                                                        },
                                                        "last4": {
                                                            "type": "string"
                                                        },
                                                        "state": {
                                                            "type": "string"
                                                        },
                                                        "vehicle_uuid": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "driver_uuid": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "monthly_limit": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "currency": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "expires_month": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "row_version": {
                                                            "type": "string"
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "provider",
                                                        "label",
                                                        "last4",
                                                        "state",
                                                        "vehicle_uuid",
                                                        "driver_uuid",
                                                        "monthly_limit",
                                                        "currency",
                                                        "expires_month",
                                                        "row_version",
                                                        "created_at",
                                                        "updated_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/fuel-cards/{uuid}/retire": {
            "post": {
                "operationId": "fuel_cards.retire",
                "description": "Stops an active card or marks it lost. It is final: the card keeps its history but never changes state or holder again, so `confirm` must be true. Send the `row_version` you read; a card changed meanwhile answers 409, and one already stopped or lost answers 422.\n\nRequires the key scope `fleet:fuel_cards:write`.",
                "summary": "Stop a fuel card or mark it lost",
                "tags": [
                    "FuelCardWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/RetireFuelCardRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The version of the card you read.",
                                                "examples": [
                                                    1
                                                ]
                                            },
                                            "state": {
                                                "type": "string",
                                                "description": "stopped or lost.",
                                                "examples": [
                                                    "stopped"
                                                ]
                                            },
                                            "confirm": {
                                                "type": "boolean",
                                                "description": "Must be true.",
                                                "examples": [
                                                    true
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version",
                                            "state",
                                            "confirm"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The fuel card, now stopped or lost.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "3b7e5a92-1c4d-4e68-9f03-7a2d8c6b1e45",
                                                "provider": "Aldrees",
                                                "label": "Truck 12 card",
                                                "last4": "4821",
                                                "state": "active",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "driver_uuid": null,
                                                "monthly_limit": "5000.00",
                                                "currency": "SAR",
                                                "expires_month": "2028-03",
                                                "row_version": 1,
                                                "created_at": "2026-05-12T09:20:00Z",
                                                "updated_at": "2026-05-12T09:20:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "provider": {
                                                            "type": "string"
                                                        },
                                                        "label": {
                                                            "type": "string"
                                                        },
                                                        "last4": {
                                                            "type": "string"
                                                        },
                                                        "state": {
                                                            "type": "string"
                                                        },
                                                        "vehicle_uuid": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "driver_uuid": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "monthly_limit": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "currency": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "expires_month": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "row_version": {
                                                            "type": "string"
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "provider",
                                                        "label",
                                                        "last4",
                                                        "state",
                                                        "vehicle_uuid",
                                                        "driver_uuid",
                                                        "monthly_limit",
                                                        "currency",
                                                        "expires_month",
                                                        "row_version",
                                                        "created_at",
                                                        "updated_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/fuel-logs": {
            "get": {
                "operationId": "fuel_logs.index",
                "description": "Lists your company's refuels, oldest first, one page at a time. Each carries the vehicle and branch by uuid, when it was filled, the litres, the amount in the currency, the odometer, whether the tank was filled, and the station. Receipts, the driver and who entered the refuel are never shown.\n\nRequires the key scope `fuel_logs:read`.",
                "summary": "List refuels",
                "tags": [
                    "FuelLog"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only refuels in this state: active or voided. Voided refuels are left out unless you ask for them.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "voided"
                    },
                    {
                        "name": "vehicle",
                        "in": "query",
                        "description": "Only the refuels of this vehicle (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "branch",
                        "in": "query",
                        "description": "Only refuels of this branch (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only refuels changed at or after this moment (ISO 8601 with an offset, e.g. 2026-05-01T00:00:00Z).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of refuels.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "5c2f9a14-8d3e-4b67-a1f0-6e4b7d9c2a58",
                                                    "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                    "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                    "target": "engine_tank",
                                                    "filled_at": "2026-05-12T09:15:00Z",
                                                    "litres": "120.50",
                                                    "amount": "289.20",
                                                    "currency": "SAR",
                                                    "odometer_km": 184250,
                                                    "is_full_tank": true,
                                                    "station": "Al Rajhi Fuel Station",
                                                    "card_uuid": "9a4c1d7e-3b52-4f08-b6a1-2d8e5c0f7a33",
                                                    "voided_at": null,
                                                    "created_at": "2026-05-12T09:20:00Z",
                                                    "updated_at": "2026-05-12T09:20:00Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:30:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "post": {
                "operationId": "fuel_logs.create",
                "description": "Records a refuel of the engine tank of one of your company's vehicles, as the panel does, with the same checks (not in the future, the litres range, the odometer order, no second refuel of the tank in the same minute) and the same review flags. A driver, a receipt, a compartment and a cargo tank load are not accepted here. Retry safely with the same Idempotency-Key. A refuel older than 45 days is refused. At most 120 refuels an hour for one key, 24 an hour for one vehicle and 2000 a day for one company.\n\nRequires the key scope `fleet:fuel_logs:write`.",
                "summary": "Record a refuel",
                "tags": [
                    "FuelLogWrite"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/CreateFuelLogRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "vehicle": {
                                                "type": "string",
                                                "format": "uuid",
                                                "description": "The vehicle, by its uuid.",
                                                "examples": [
                                                    "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11"
                                                ]
                                            },
                                            "filled_at": {
                                                "type": "string",
                                                "format": "date-time",
                                                "description": "When the tank was filled, ISO 8601 with an offset.",
                                                "examples": [
                                                    "2026-05-12T09:15:00+03:00"
                                                ]
                                            },
                                            "litres": {
                                                "type": "string",
                                                "description": "The litres, a decimal above zero.",
                                                "examples": [
                                                    "120.50"
                                                ]
                                            },
                                            "amount": {
                                                "type": "string",
                                                "description": "The amount paid, with the currency.",
                                                "examples": [
                                                    "289.20"
                                                ]
                                            },
                                            "currency": {
                                                "type": "string",
                                                "description": "The code of an enabled currency, required with the amount.",
                                                "examples": [
                                                    "SAR"
                                                ]
                                            },
                                            "odometer_km": {
                                                "type": "integer",
                                                "description": "The odometer in whole kilometres.",
                                                "examples": [
                                                    184250
                                                ]
                                            },
                                            "is_full_tank": {
                                                "type": "boolean",
                                                "description": "Whether the tank was filled.",
                                                "examples": [
                                                    true
                                                ]
                                            },
                                            "station": {
                                                "type": "string",
                                                "description": "The station name, up to 200 characters of plain text.",
                                                "examples": [
                                                    "Al Rajhi Fuel Station"
                                                ]
                                            },
                                            "card": {
                                                "type": "string",
                                                "format": "uuid",
                                                "description": "The fuel card that paid it, by uuid: an active, unexpired card of your company held by this vehicle or by none."
                                            }
                                        },
                                        "required": [
                                            "vehicle",
                                            "filled_at",
                                            "litres",
                                            "is_full_tank"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The refuel that was recorded.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "5c2f9a14-8d3e-4b67-a1f0-6e4b7d9c2a58",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                "target": "engine_tank",
                                                "filled_at": "2026-05-12T09:15:00Z",
                                                "litres": "120.50",
                                                "amount": "289.20",
                                                "currency": "SAR",
                                                "odometer_km": 184250,
                                                "is_full_tank": true,
                                                "station": "Al Rajhi Fuel Station",
                                                "card_uuid": "9a4c1d7e-3b52-4f08-b6a1-2d8e5c0f7a33",
                                                "voided_at": null,
                                                "created_at": "2026-05-12T09:20:00Z",
                                                "updated_at": "2026-05-12T09:20:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uuid": {
                                                    "type": "string"
                                                },
                                                "vehicle_uuid": {
                                                    "type": "string"
                                                },
                                                "branch_uuid": {
                                                    "type": "string"
                                                },
                                                "target": {
                                                    "type": "string"
                                                },
                                                "filled_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "litres": {
                                                    "type": "string"
                                                },
                                                "amount": {
                                                    "type": "string"
                                                },
                                                "currency": {
                                                    "type": "string"
                                                },
                                                "odometer_km": {
                                                    "type": "string"
                                                },
                                                "is_full_tank": {
                                                    "type": "string"
                                                },
                                                "station": {
                                                    "type": "string"
                                                },
                                                "card_uuid": {
                                                    "type": "string"
                                                },
                                                "voided_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "uuid",
                                                "vehicle_uuid",
                                                "branch_uuid",
                                                "target",
                                                "filled_at",
                                                "litres",
                                                "amount",
                                                "currency",
                                                "odometer_km",
                                                "is_full_tank",
                                                "station",
                                                "card_uuid",
                                                "voided_at",
                                                "created_at",
                                                "updated_at"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/fuel-logs/{uuid}": {
            "get": {
                "operationId": "fuel_logs.show",
                "description": "Reads one of your company's refuels by its uuid. A record of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `fuel_logs:read`.",
                "summary": "Read a refuel",
                "tags": [
                    "FuelLog"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The refuel.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "5c2f9a14-8d3e-4b67-a1f0-6e4b7d9c2a58",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                "target": "engine_tank",
                                                "filled_at": "2026-05-12T09:15:00Z",
                                                "litres": "120.50",
                                                "amount": "289.20",
                                                "currency": "SAR",
                                                "odometer_km": 184250,
                                                "is_full_tank": true,
                                                "station": "Al Rajhi Fuel Station",
                                                "card_uuid": "9a4c1d7e-3b52-4f08-b6a1-2d8e5c0f7a33",
                                                "voided_at": null,
                                                "created_at": "2026-05-12T09:20:00Z",
                                                "updated_at": "2026-05-12T09:20:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:30:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "additionalProperties": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/fuel-log-reviews": {
            "get": {
                "operationId": "fuel_log_reviews.index",
                "description": "Lists the refuels the checks flagged for review, newest first, one page at a time; the open ones unless you name a state or an outcome. Requires the key scope `fleet:fuel_reviews:write` and an owner who may review refuels.\n\nRequires the key scope `fleet:fuel_reviews:write`.",
                "summary": "List refuel reviews",
                "tags": [
                    "FuelLogReview"
                ],
                "parameters": [
                    {
                        "name": "state",
                        "in": "query",
                        "description": "open (default), follow_up or reviewed.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "open"
                    },
                    {
                        "name": "outcome",
                        "in": "query",
                        "description": "correct, entry_error or follow_up.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of reviews.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "9e2b7c14-6d3a-4a58-8b01-4f7c2d9e6a30",
                                                    "fuel_log_uuid": "1a7d3c52-8e4b-4f09-b6a2-5c0d9e1f7b84",
                                                    "reasons": [
                                                        {
                                                            "code": "over_tank",
                                                            "values": {
                                                                "litres": 80,
                                                                "tank_litres": 60
                                                            }
                                                        }
                                                    ],
                                                    "state": "open",
                                                    "outcome": null,
                                                    "flagged_at": "2026-11-17T08:00:00Z",
                                                    "reviewed_at": null,
                                                    "row_version": 1
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-17T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/fuel-log-reviews/{uuid}/review": {
            "post": {
                "operationId": "fuel_log_reviews.review",
                "description": "Answers the review of a flagged refuel with an outcome and a note, as the panel does. A stale `row_version` or a review already answered gives 409. The refuel itself is never changed. Requires the key scope `fleet:fuel_reviews:write`, an owner who may review refuels and who did not enter the refuel, and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:fuel_reviews:write`.",
                "summary": "Answer a refuel review",
                "tags": [
                    "FuelLogReview"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/ReviewFuelLogRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The row_version you read.",
                                                "examples": [
                                                    1
                                                ]
                                            },
                                            "outcome": {
                                                "type": "string",
                                                "description": "correct, entry_error or follow_up.",
                                                "examples": [
                                                    "correct"
                                                ]
                                            },
                                            "note": {
                                                "type": "string",
                                                "description": "What you found, 3 to 500 characters.",
                                                "examples": [
                                                    "Checked against the receipt"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version",
                                            "outcome",
                                            "note"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The review, now answered.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "9e2b7c14-6d3a-4a58-8b01-4f7c2d9e6a30",
                                                "fuel_log_uuid": "1a7d3c52-8e4b-4f09-b6a2-5c0d9e1f7b84",
                                                "reasons": [
                                                    {
                                                        "code": "over_tank",
                                                        "values": {
                                                            "litres": 80,
                                                            "tank_litres": 60
                                                        }
                                                    }
                                                ],
                                                "state": "reviewed",
                                                "outcome": "correct",
                                                "flagged_at": "2026-11-17T08:00:00Z",
                                                "reviewed_at": null,
                                                "row_version": 2
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-17T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "fuel_log_uuid": {
                                                            "type": "string"
                                                        },
                                                        "reasons": {
                                                            "type": "string"
                                                        },
                                                        "state": {
                                                            "type": "string"
                                                        },
                                                        "outcome": {
                                                            "type": "string"
                                                        },
                                                        "flagged_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "reviewed_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "row_version": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "fuel_log_uuid",
                                                        "reasons",
                                                        "state",
                                                        "outcome",
                                                        "flagged_at",
                                                        "reviewed_at",
                                                        "row_version"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/fuel-logs/{uuid}/void": {
            "post": {
                "operationId": "fuel_logs.void",
                "description": "Voids an engine-tank refuel with a reason of ten to five hundred characters, as the panel does; the voided refuel stays in the record and no longer counts, and your company's fuel managers are told. A cargo tank load is voided in the panel only (422). Send the `row_version` you read; a refuel changed meanwhile answers 409, and one already voided answers 422. The voids of one key and of one company in a day are capped by governed settings.\n\nRequires the key scope `fleet:fuel_logs:write`.",
                "summary": "Void a refuel",
                "tags": [
                    "FuelLogWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/VoidFuelLogRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The version of the refuel you read.",
                                                "examples": [
                                                    1
                                                ]
                                            },
                                            "reason": {
                                                "type": "string",
                                                "description": "Why it is voided, 10 to 500 characters of plain text.",
                                                "examples": [
                                                    "Entered twice by the station sheet"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version",
                                            "reason"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The refuel, now voided.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "5c2f9a14-8d3e-4b67-a1f0-6e4b7d9c2a58",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                "target": "engine_tank",
                                                "filled_at": "2026-05-12T09:15:00Z",
                                                "litres": "120.50",
                                                "amount": "289.20",
                                                "currency": "SAR",
                                                "odometer_km": 184250,
                                                "is_full_tank": true,
                                                "station": "Al Rajhi Fuel Station",
                                                "card_uuid": "9a4c1d7e-3b52-4f08-b6a1-2d8e5c0f7a33",
                                                "voided_at": null,
                                                "created_at": "2026-05-12T09:20:00Z",
                                                "updated_at": "2026-05-12T09:20:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "vehicle_uuid": {
                                                            "type": "string"
                                                        },
                                                        "branch_uuid": {
                                                            "type": "string"
                                                        },
                                                        "target": {
                                                            "type": "string"
                                                        },
                                                        "filled_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "litres": {
                                                            "type": "string"
                                                        },
                                                        "amount": {
                                                            "type": "string"
                                                        },
                                                        "currency": {
                                                            "type": "string"
                                                        },
                                                        "odometer_km": {
                                                            "type": "string"
                                                        },
                                                        "is_full_tank": {
                                                            "type": "string"
                                                        },
                                                        "station": {
                                                            "type": "string"
                                                        },
                                                        "card_uuid": {
                                                            "type": "string"
                                                        },
                                                        "voided_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "vehicle_uuid",
                                                        "branch_uuid",
                                                        "target",
                                                        "filled_at",
                                                        "litres",
                                                        "amount",
                                                        "currency",
                                                        "odometer_km",
                                                        "is_full_tank",
                                                        "station",
                                                        "card_uuid",
                                                        "voided_at",
                                                        "created_at",
                                                        "updated_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/fuel-prices": {
            "get": {
                "operationId": "fuel_prices.index",
                "description": "Lists the price of a litre of fuel your company recorded for itself, by fuel type and the day it starts, oldest first, one page at a time. The official prices and the notes are not part of this list.\n\nRequires the key scope `fuel_prices:read`.",
                "summary": "List fuel prices",
                "tags": [
                    "FuelPrice"
                ],
                "parameters": [
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only prices recorded at or after this moment (ISO 8601 with an offset, e.g. 2026-05-01T00:00:00Z).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of fuel prices.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "9d4e2b61-3a7c-4f58-b0e9-1c6a8d5f7e32",
                                                    "fuel_type_code": "diesel",
                                                    "price_minor": 166,
                                                    "currency": "SAR",
                                                    "effective_from": "2026-05-01",
                                                    "created_at": "2026-05-01T08:00:00Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:30:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/fuel-prices/{uuid}": {
            "get": {
                "operationId": "fuel_prices.show",
                "description": "Reads one fuel price your company recorded, by its uuid. A record of another company answers 404 exactly like one that does not exist.\n\nRequires the key scope `fuel_prices:read`.",
                "summary": "Read a fuel price",
                "tags": [
                    "FuelPrice"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The fuel price.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "9d4e2b61-3a7c-4f58-b0e9-1c6a8d5f7e32",
                                                "fuel_type_code": "diesel",
                                                "price_minor": 166,
                                                "currency": "SAR",
                                                "effective_from": "2026-05-01",
                                                "created_at": "2026-05-01T08:00:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:30:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "additionalProperties": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/reports/fuel": {
            "get": {
                "operationId": "reports.fuel",
                "description": "Lists, for each of your vehicles that refuelled in the period, the refuels, the litres, the distance and the consumption. A key whose owner may see fuel costs also gets the amounts paid, one line per currency, the fuel cost per kilometre (the average price paid per litre times the litres burned per km, in the one currency paid, never from the estimate) and a separate estimate for the refuels that carry no amount, valued at the price list of the day; the estimate is never part of the amounts. The period is required and at most 366 days. Never a driver.\n\nRequires the key scope `reporting:reports_fuel:read`.",
                "summary": "Read the fuel report",
                "tags": [
                    "FuelReport"
                ],
                "parameters": [
                    {
                        "name": "from",
                        "in": "query",
                        "required": true,
                        "description": "Start of the period, ISO 8601 with an offset.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "required": true,
                        "description": "End of the period, after from and at most 366 days later.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "vehicle",
                        "in": "query",
                        "description": "Only this vehicle (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "One page of vehicles that refuelled in the period; the amount fields appear only for a key whose owner may see fuel costs.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "vehicle_uuid": "7c1d2e44-5b6a-4f0e-9a3b-1d2c3e4f5a66",
                                                    "plate": "ABC 1234",
                                                    "refuels": 6,
                                                    "litres": 412.5,
                                                    "distance_km": 3120,
                                                    "litres_per_100km": 13.2,
                                                    "consumption_source": "receipts",
                                                    "rated_litres_per_100km": null,
                                                    "trip_distance_km": null,
                                                    "expected_litres": null
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": []
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "page": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "limit": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": "integer"
                                                                                },
                                                                                []
                                                                            ]
                                                                        },
                                                                        "next_cursor": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": [
                                                                                        "string",
                                                                                        "null"
                                                                                    ]
                                                                                },
                                                                                []
                                                                            ]
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "limit",
                                                                        "next_cursor"
                                                                    ],
                                                                    "additionalProperties": []
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timezone": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "page",
                                                        "timezone"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    },
                                                    "minItems": 0,
                                                    "maxItems": 0
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "page": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "limit": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": "integer"
                                                                                },
                                                                                []
                                                                            ]
                                                                        },
                                                                        "next_cursor": []
                                                                    },
                                                                    "required": [
                                                                        "limit",
                                                                        "next_cursor"
                                                                    ],
                                                                    "additionalProperties": []
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timezone": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "page",
                                                        "timezone"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/geofences": {
            "get": {
                "operationId": "geofences.index",
                "description": "Lists your company's geofences, oldest first, one page at a time, each with its current shape: a circle (centre and radius), a polygon (its vertices) or a corridor (its route as vertices, radius_m as its width on each side, and its own stop, fuel-drop, planned-stop and active-window limits; empty for the other shapes). Times are UTC; meta.timezone names the platform time zone.\n\nRequires the key scope `geofences:read`.",
                "summary": "List geofences",
                "tags": [
                    "Geofence"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only geofences in this state: active, paused or retired.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "active"
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only geofences changed at or after this moment (ISO 8601 with an offset, e.g. 2026-05-01T00:00:00Z).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of geofences.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "4d2a6e91-7b35-4c08-9f1e-3a8c5d0b2e99",
                                                    "name": {
                                                        "ar": "مستودع الرياض",
                                                        "en": "Riyadh depot"
                                                    },
                                                    "status": "active",
                                                    "shape": "circle",
                                                    "center_latitude": 24.7136,
                                                    "center_longitude": 46.6753,
                                                    "radius_m": 500,
                                                    "vertices": [],
                                                    "dwell_limit_minutes": 60,
                                                    "stop_limit_minutes": null,
                                                    "gps_tolerance_m": null,
                                                    "fuel_drop_percent": null,
                                                    "fuel_drop_litres": null,
                                                    "planned_stops": [],
                                                    "active_from": null,
                                                    "active_until": null,
                                                    "group": null,
                                                    "events_enabled": false,
                                                    "scope": {
                                                        "kind": "all",
                                                        "vehicle_uuids": []
                                                    },
                                                    "version": 3,
                                                    "row_version": 3,
                                                    "created_at": "2026-03-01T08:30:00Z",
                                                    "updated_at": "2026-05-12T11:05:42Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "post": {
                "operationId": "geofences.store",
                "description": "Creates a geofence for your company: a circle (centre and radius), a polygon (its vertices) or a corridor (its route as vertices, radius_m as its width on each side, and its own limits). It watches all your vehicles unless you send scope: kind all, refrigerated, or vehicles with vehicle_uuids. Send an Idempotency-Key header. Plan limits and the shape rules are the same as in the portal. Answers 403 for a key limited to one branch.\n\nRequires the key scope `compliance:geofences:write`.",
                "summary": "Create a geofence",
                "tags": [
                    "GeofenceWrite"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/GeofenceWriteRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "name": {
                                                "type": "object",
                                                "description": "The name: an object with ar (required, up to 120 characters) and en (optional), plain text.",
                                                "examples": [
                                                    {
                                                        "ar": "مستودع الرياض",
                                                        "en": "Riyadh depot"
                                                    }
                                                ]
                                            },
                                            "group": {
                                                "type": "string",
                                                "description": "A free label to group zones, up to 60 characters; null for none.",
                                                "examples": [
                                                    "Depots"
                                                ]
                                            },
                                            "shape": {
                                                "type": "string",
                                                "description": "circle, polygon or corridor.",
                                                "examples": [
                                                    "circle"
                                                ]
                                            },
                                            "center_latitude": {
                                                "type": "object",
                                                "description": "The centre latitude of a circle, -90 to 90.",
                                                "examples": [
                                                    24.7136
                                                ]
                                            },
                                            "center_longitude": {
                                                "type": "object",
                                                "description": "The centre longitude of a circle, -180 to 180.",
                                                "examples": [
                                                    46.6753
                                                ]
                                            },
                                            "radius_m": {
                                                "type": "integer",
                                                "description": "The radius of a circle, or the width on each side of a corridor, in metres.",
                                                "examples": [
                                                    500
                                                ]
                                            },
                                            "vertices": {
                                                "type": "array",
                                                "description": "The corners of a polygon or the route of a corridor, up to 1000 latitude and longitude pairs.",
                                                "examples": [
                                                    [
                                                        {
                                                            "latitude": 24.7,
                                                            "longitude": 46.6
                                                        },
                                                        {
                                                            "latitude": 24.8,
                                                            "longitude": 46.7
                                                        },
                                                        {
                                                            "latitude": 24.7,
                                                            "longitude": 46.8
                                                        }
                                                    ]
                                                ],
                                                "items": []
                                            },
                                            "planned_stops": {
                                                "type": "array",
                                                "description": "The planned stops of a corridor as latitude and longitude pairs.",
                                                "examples": [
                                                    [
                                                        {
                                                            "latitude": 24.75,
                                                            "longitude": 46.65
                                                        }
                                                    ]
                                                ],
                                                "items": []
                                            },
                                            "dwell_limit_minutes": {
                                                "type": "integer",
                                                "description": "Minutes inside before a long-stay alert.",
                                                "examples": [
                                                    120
                                                ]
                                            },
                                            "stop_limit_minutes": {
                                                "type": "integer",
                                                "description": "Minutes stopped before a stop alert.",
                                                "examples": [
                                                    30
                                                ]
                                            },
                                            "gps_tolerance_m": {
                                                "type": "integer",
                                                "description": "Metres of GPS tolerance at the border.",
                                                "examples": [
                                                    25
                                                ]
                                            },
                                            "fuel_drop_percent": {
                                                "type": "integer",
                                                "description": "A fuel drop in percent that raises an alert inside the zone.",
                                                "examples": [
                                                    10
                                                ]
                                            },
                                            "fuel_drop_litres": {
                                                "type": "integer",
                                                "description": "A fuel drop in litres that raises an alert inside the zone.",
                                                "examples": [
                                                    20
                                                ]
                                            },
                                            "active_from": {
                                                "type": "string",
                                                "format": "date-time",
                                                "description": "When the zone starts to watch (ISO 8601).",
                                                "examples": [
                                                    "2026-06-01T00:00:00Z"
                                                ]
                                            },
                                            "active_until": {
                                                "type": "string",
                                                "format": "date-time",
                                                "description": "When the zone stops watching (ISO 8601).",
                                                "examples": [
                                                    "2026-12-31T00:00:00Z"
                                                ]
                                            },
                                            "scope": {
                                                "type": "object",
                                                "description": "Which vehicles it watches: kind all, refrigerated or vehicles (then vehicle_uuids, 1 to 500).",
                                                "examples": [
                                                    {
                                                        "kind": "vehicles",
                                                        "vehicle_uuids": [
                                                            "7c1d2e44-5b6a-4f0e-9a3b-1d2c3e4f5a66"
                                                        ]
                                                    }
                                                ]
                                            }
                                        },
                                        "required": [
                                            "name",
                                            "shape"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The new geofence; its row_version is the token for the next change.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "4d2a6e91-7b35-4c08-9f1e-3a8c5d0b2e99",
                                                "name": {
                                                    "ar": "مستودع الرياض",
                                                    "en": "Riyadh depot"
                                                },
                                                "status": "active",
                                                "shape": "circle",
                                                "center_latitude": 24.7136,
                                                "center_longitude": 46.6753,
                                                "radius_m": 500,
                                                "vertices": [],
                                                "dwell_limit_minutes": 60,
                                                "stop_limit_minutes": null,
                                                "gps_tolerance_m": null,
                                                "fuel_drop_percent": null,
                                                "fuel_drop_litres": null,
                                                "planned_stops": [],
                                                "active_from": null,
                                                "active_until": null,
                                                "group": null,
                                                "events_enabled": false,
                                                "scope": {
                                                    "kind": "all",
                                                    "vehicle_uuids": []
                                                },
                                                "version": 3,
                                                "row_version": 1,
                                                "created_at": "2026-03-01T08:30:00Z",
                                                "updated_at": "2026-05-12T11:05:42Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "additionalProperties": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/geofences/{uuid}": {
            "get": {
                "operationId": "geofences.show",
                "description": "Reads one of your company's geofences by its uuid, with its current shape. A geofence of another company answers 404 exactly like one that does not exist.\n\nRequires the key scope `geofences:read`.",
                "summary": "Read a geofence",
                "tags": [
                    "Geofence"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The geofence.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "4d2a6e91-7b35-4c08-9f1e-3a8c5d0b2e99",
                                                "name": {
                                                    "ar": "مستودع الرياض",
                                                    "en": "Riyadh depot"
                                                },
                                                "status": "active",
                                                "shape": "circle",
                                                "center_latitude": 24.7136,
                                                "center_longitude": 46.6753,
                                                "radius_m": 500,
                                                "vertices": [],
                                                "dwell_limit_minutes": 60,
                                                "stop_limit_minutes": null,
                                                "gps_tolerance_m": null,
                                                "fuel_drop_percent": null,
                                                "fuel_drop_litres": null,
                                                "planned_stops": [],
                                                "active_from": null,
                                                "active_until": null,
                                                "group": null,
                                                "events_enabled": false,
                                                "scope": {
                                                    "kind": "all",
                                                    "vehicle_uuids": []
                                                },
                                                "version": 3,
                                                "row_version": 3,
                                                "created_at": "2026-03-01T08:30:00Z",
                                                "updated_at": "2026-05-12T11:05:42Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "additionalProperties": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "put": {
                "operationId": "geofences.update",
                "description": "Replaces the name and shape of one of your geofences with the body, as a new version: anything you leave out is cleared. Without scope the vehicles it watches stay as they are; without group its group stays. Send the row_version you read and an Idempotency-Key header; a stale row_version answers 409. A retired geofence never changes again. A geofence of another company answers 404 exactly like one that does not exist.\n\nRequires the key scope `compliance:geofences:write`.",
                "summary": "Replace a geofence",
                "tags": [
                    "GeofenceWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/GeofenceWriteRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The row_version you read; a stale one answers 409.",
                                                "examples": [
                                                    3
                                                ]
                                            },
                                            "name": {
                                                "type": "object",
                                                "description": "The name: an object with ar (required, up to 120 characters) and en (optional), plain text.",
                                                "examples": [
                                                    {
                                                        "ar": "مستودع الرياض",
                                                        "en": "Riyadh depot"
                                                    }
                                                ]
                                            },
                                            "group": {
                                                "type": "string",
                                                "description": "A free label to group zones, up to 60 characters; null for none.",
                                                "examples": [
                                                    "Depots"
                                                ]
                                            },
                                            "shape": {
                                                "type": "string",
                                                "description": "circle, polygon or corridor.",
                                                "examples": [
                                                    "circle"
                                                ]
                                            },
                                            "center_latitude": {
                                                "type": "object",
                                                "description": "The centre latitude of a circle, -90 to 90.",
                                                "examples": [
                                                    24.7136
                                                ]
                                            },
                                            "center_longitude": {
                                                "type": "object",
                                                "description": "The centre longitude of a circle, -180 to 180.",
                                                "examples": [
                                                    46.6753
                                                ]
                                            },
                                            "radius_m": {
                                                "type": "integer",
                                                "description": "The radius of a circle, or the width on each side of a corridor, in metres.",
                                                "examples": [
                                                    500
                                                ]
                                            },
                                            "vertices": {
                                                "type": "array",
                                                "description": "The corners of a polygon or the route of a corridor, up to 1000 latitude and longitude pairs.",
                                                "examples": [
                                                    [
                                                        {
                                                            "latitude": 24.7,
                                                            "longitude": 46.6
                                                        },
                                                        {
                                                            "latitude": 24.8,
                                                            "longitude": 46.7
                                                        },
                                                        {
                                                            "latitude": 24.7,
                                                            "longitude": 46.8
                                                        }
                                                    ]
                                                ],
                                                "items": []
                                            },
                                            "planned_stops": {
                                                "type": "array",
                                                "description": "The planned stops of a corridor as latitude and longitude pairs.",
                                                "examples": [
                                                    [
                                                        {
                                                            "latitude": 24.75,
                                                            "longitude": 46.65
                                                        }
                                                    ]
                                                ],
                                                "items": []
                                            },
                                            "dwell_limit_minutes": {
                                                "type": "integer",
                                                "description": "Minutes inside before a long-stay alert.",
                                                "examples": [
                                                    120
                                                ]
                                            },
                                            "stop_limit_minutes": {
                                                "type": "integer",
                                                "description": "Minutes stopped before a stop alert.",
                                                "examples": [
                                                    30
                                                ]
                                            },
                                            "gps_tolerance_m": {
                                                "type": "integer",
                                                "description": "Metres of GPS tolerance at the border.",
                                                "examples": [
                                                    25
                                                ]
                                            },
                                            "fuel_drop_percent": {
                                                "type": "integer",
                                                "description": "A fuel drop in percent that raises an alert inside the zone.",
                                                "examples": [
                                                    10
                                                ]
                                            },
                                            "fuel_drop_litres": {
                                                "type": "integer",
                                                "description": "A fuel drop in litres that raises an alert inside the zone.",
                                                "examples": [
                                                    20
                                                ]
                                            },
                                            "active_from": {
                                                "type": "string",
                                                "format": "date-time",
                                                "description": "When the zone starts to watch (ISO 8601).",
                                                "examples": [
                                                    "2026-06-01T00:00:00Z"
                                                ]
                                            },
                                            "active_until": {
                                                "type": "string",
                                                "format": "date-time",
                                                "description": "When the zone stops watching (ISO 8601).",
                                                "examples": [
                                                    "2026-12-31T00:00:00Z"
                                                ]
                                            },
                                            "scope": {
                                                "type": "object",
                                                "description": "Which vehicles it watches: kind all, refrigerated or vehicles (then vehicle_uuids, 1 to 500).",
                                                "examples": [
                                                    {
                                                        "kind": "vehicles",
                                                        "vehicle_uuids": [
                                                            "7c1d2e44-5b6a-4f0e-9a3b-1d2c3e4f5a66"
                                                        ]
                                                    }
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version",
                                            "name",
                                            "shape"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The geofence with its new row_version.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "4d2a6e91-7b35-4c08-9f1e-3a8c5d0b2e99",
                                                "name": {
                                                    "ar": "مستودع الرياض",
                                                    "en": "Riyadh depot"
                                                },
                                                "status": "active",
                                                "shape": "circle",
                                                "center_latitude": 24.7136,
                                                "center_longitude": 46.6753,
                                                "radius_m": 500,
                                                "vertices": [],
                                                "dwell_limit_minutes": 60,
                                                "stop_limit_minutes": null,
                                                "gps_tolerance_m": null,
                                                "fuel_drop_percent": null,
                                                "fuel_drop_litres": null,
                                                "planned_stops": [],
                                                "active_from": null,
                                                "active_until": null,
                                                "group": null,
                                                "events_enabled": false,
                                                "scope": {
                                                    "kind": "all",
                                                    "vehicle_uuids": []
                                                },
                                                "version": 3,
                                                "row_version": 4,
                                                "created_at": "2026-03-01T08:30:00Z",
                                                "updated_at": "2026-05-12T11:05:42Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/geofence-visits": {
            "get": {
                "operationId": "geofence_visits.index",
                "description": "Lists the stays of your company's vehicles in its geofences, oldest first, one page at a time; each carries the geofence, the vehicle and the driver by uuid and when it began and ended (exited_at is null while the vehicle is inside), under an opaque ref. A branch-limited key sees only its own branch. Times are UTC; meta.timezone names the platform time zone.\n\nRequires the key scope `geofences:read`.",
                "summary": "List geofence visits",
                "tags": [
                    "GeofenceVisit"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only visits still open (open) or already ended (closed).",
                        "schema": {
                            "type": "string"
                        },
                        "example": "open"
                    },
                    {
                        "name": "geofence",
                        "in": "query",
                        "description": "Only the visits to this geofence (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "vehicle",
                        "in": "query",
                        "description": "Only the visits of this vehicle (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "branch",
                        "in": "query",
                        "description": "Only visits of this branch (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "entered_since",
                        "in": "query",
                        "description": "Only visits that began at or after this moment (ISO 8601 with an offset, e.g. 2026-05-01T00:00:00Z).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of geofence visits.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "ref": "Zk3Q8vTn0aXy7mP2cLw9dA",
                                                    "geofence_uuid": "4d2a6e91-7b35-4c08-9f1e-3a8c5d0b2e99",
                                                    "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                    "driver_uuid": null,
                                                    "entered_at": "2026-06-01T08:15:00Z",
                                                    "exited_at": "2026-06-01T09:40:12Z",
                                                    "dwell_exceeded": false,
                                                    "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable: the platform has no public-id key configured; the visit calls refuse until its operator sets it.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string",
                                    "examples": [
                                        {
                                            "success": false,
                                            "data": null,
                                            "error": {
                                                "code": "service_unavailable",
                                                "message": "The service is temporarily unavailable. Retry later."
                                            },
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/geofence-visits/{ref}": {
            "get": {
                "operationId": "geofence_visits.show",
                "description": "Reads one stay of your company's vehicles in a geofence by its ref. A visit of another company or branch and an unknown ref answer 404.\n\nRequires the key scope `geofences:read`.",
                "summary": "Read a geofence visit",
                "tags": [
                    "GeofenceVisit"
                ],
                "parameters": [
                    {
                        "name": "ref",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The geofence visit.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "ref": "Zk3Q8vTn0aXy7mP2cLw9dA",
                                                "geofence_uuid": "4d2a6e91-7b35-4c08-9f1e-3a8c5d0b2e99",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "driver_uuid": null,
                                                "entered_at": "2026-06-01T08:15:00Z",
                                                "exited_at": "2026-06-01T09:40:12Z",
                                                "dwell_exceeded": false,
                                                "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable: the platform has no public-id key configured; the visit calls refuse until its operator sets it.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string",
                                    "examples": [
                                        {
                                            "success": false,
                                            "data": null,
                                            "error": {
                                                "code": "service_unavailable",
                                                "message": "The service is temporarily unavailable. Retry later."
                                            },
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/geofences/import": {
            "post": {
                "operationId": "geofences.import",
                "description": "Creates up to 50 geofences in one call, all or nothing, with the plan and company limits of the portal, whose import is also a direct creation by a manager. With dry_run true nothing is written and each zone gets its verdict. All zones share the optional scope. One key creates at most 500 zones a day by import. Send an Idempotency-Key header. Answers 403 for a key limited to one branch.\n\nRequires the key scope `compliance:geofences:write`.",
                "summary": "Import geofences",
                "tags": [
                    "GeofenceWrite"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/GeofenceImportRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "dry_run": {
                                                "type": "boolean",
                                                "description": "True to check every zone and write nothing.",
                                                "examples": [
                                                    true
                                                ]
                                            },
                                            "zones": {
                                                "type": "array",
                                                "description": "1 to 50 zones, each with the body of a created geofence.",
                                                "examples": [
                                                    [
                                                        {
                                                            "name": {
                                                                "ar": "مستودع الرياض"
                                                            },
                                                            "shape": "circle",
                                                            "center_latitude": 24.7136,
                                                            "center_longitude": 46.6753,
                                                            "radius_m": 500
                                                        }
                                                    ]
                                                ],
                                                "items": []
                                            }
                                        },
                                        "required": [
                                            "dry_run",
                                            "zones"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "dry_run": {
                                                    "type": "boolean"
                                                },
                                                "created": {
                                                    "type": "integer"
                                                }
                                            },
                                            "required": [
                                                "dry_run",
                                                "created"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "The verdict of each zone (dry_run true) or the number created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "dry_run": true,
                                                "ready": 1,
                                                "refused": 0,
                                                "zones": [
                                                    {
                                                        "position": 1,
                                                        "ready": true,
                                                        "reason": null
                                                    }
                                                ]
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "dry_run": {
                                                            "type": "boolean"
                                                        },
                                                        "ready": {
                                                            "type": "integer"
                                                        },
                                                        "refused": {
                                                            "type": "integer"
                                                        },
                                                        "zones": {
                                                            "type": "array",
                                                            "items": []
                                                        }
                                                    },
                                                    "required": [
                                                        "dry_run",
                                                        "ready",
                                                        "refused",
                                                        "zones"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/geofences/{uuid}/status": {
            "post": {
                "operationId": "geofences.status",
                "description": "Pauses (paused), resumes (active) or retires (retired) one of your geofences. Retiring is final: a retired geofence cannot be resumed. Send the row_version you read and an Idempotency-Key header; a stale row_version answers 409. A geofence of another company answers 404.\n\nRequires the key scope `compliance:geofences:write`.",
                "summary": "Change the state of a geofence",
                "tags": [
                    "GeofenceWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/GeofenceStatusRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "status": {
                                                "type": "string",
                                                "description": "paused, active or retired; retired is final.",
                                                "examples": [
                                                    "paused"
                                                ]
                                            },
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The row_version you read; a stale one answers 409.",
                                                "examples": [
                                                    3
                                                ]
                                            }
                                        },
                                        "required": [
                                            "status",
                                            "row_version"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The geofence with its new state and row_version.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "4d2a6e91-7b35-4c08-9f1e-3a8c5d0b2e99",
                                                "name": {
                                                    "ar": "مستودع الرياض",
                                                    "en": "Riyadh depot"
                                                },
                                                "status": "paused",
                                                "shape": "circle",
                                                "center_latitude": 24.7136,
                                                "center_longitude": 46.6753,
                                                "radius_m": 500,
                                                "vertices": [],
                                                "dwell_limit_minutes": 60,
                                                "stop_limit_minutes": null,
                                                "gps_tolerance_m": null,
                                                "fuel_drop_percent": null,
                                                "fuel_drop_litres": null,
                                                "planned_stops": [],
                                                "active_from": null,
                                                "active_until": null,
                                                "group": null,
                                                "events_enabled": false,
                                                "scope": {
                                                    "kind": "all",
                                                    "vehicle_uuids": []
                                                },
                                                "version": 3,
                                                "row_version": 5,
                                                "created_at": "2026-03-01T08:30:00Z",
                                                "updated_at": "2026-05-12T11:05:42Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/geofences/{uuid}/group": {
            "post": {
                "operationId": "geofences.group",
                "description": "Puts one of your geofences into a group, or out of every group with group null: a label only, so the shape keeps its version. Send the row_version you read and an Idempotency-Key header; a stale row_version answers 409. A retired geofence cannot change.\n\nRequires the key scope `compliance:geofences:write`.",
                "summary": "Change the group of a geofence",
                "tags": [
                    "GeofenceWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/GeofenceGroupRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "group": {
                                                "type": "string",
                                                "description": "The group label, up to 60 characters, or null to leave every group.",
                                                "examples": [
                                                    "Depots"
                                                ]
                                            },
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The row_version you read; a stale one answers 409.",
                                                "examples": [
                                                    3
                                                ]
                                            }
                                        },
                                        "required": [
                                            "group",
                                            "row_version"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The geofence with its new group and row_version.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "4d2a6e91-7b35-4c08-9f1e-3a8c5d0b2e99",
                                                "name": {
                                                    "ar": "مستودع الرياض",
                                                    "en": "Riyadh depot"
                                                },
                                                "status": "active",
                                                "shape": "circle",
                                                "center_latitude": 24.7136,
                                                "center_longitude": 46.6753,
                                                "radius_m": 500,
                                                "vertices": [],
                                                "dwell_limit_minutes": 60,
                                                "stop_limit_minutes": null,
                                                "gps_tolerance_m": null,
                                                "fuel_drop_percent": null,
                                                "fuel_drop_litres": null,
                                                "planned_stops": [],
                                                "active_from": null,
                                                "active_until": null,
                                                "group": "Riyadh",
                                                "events_enabled": false,
                                                "scope": {
                                                    "kind": "all",
                                                    "vehicle_uuids": []
                                                },
                                                "version": 3,
                                                "row_version": 6,
                                                "created_at": "2026-03-01T08:30:00Z",
                                                "updated_at": "2026-05-12T11:05:42Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/geofences/{uuid}/events": {
            "post": {
                "operationId": "geofences.events",
                "description": "Switches the entry and exit events of one of your geofences on or off for your company's webhooks and notices; the same rules and plan limits as the portal apply. Send the row_version you read and an Idempotency-Key header; a stale row_version answers 409. A retired geofence cannot change.\n\nRequires the key scope `compliance:geofences:write`.",
                "summary": "Switch the events of a geofence",
                "tags": [
                    "GeofenceWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/GeofenceEventsRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "enabled": {
                                                "type": "boolean",
                                                "description": "True to send entry and exit events, false to stop them.",
                                                "examples": [
                                                    true
                                                ]
                                            },
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The row_version you read; a stale one answers 409.",
                                                "examples": [
                                                    3
                                                ]
                                            }
                                        },
                                        "required": [
                                            "enabled",
                                            "row_version"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The geofence with its events flag and row_version.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "4d2a6e91-7b35-4c08-9f1e-3a8c5d0b2e99",
                                                "name": {
                                                    "ar": "مستودع الرياض",
                                                    "en": "Riyadh depot"
                                                },
                                                "status": "active",
                                                "shape": "circle",
                                                "center_latitude": 24.7136,
                                                "center_longitude": 46.6753,
                                                "radius_m": 500,
                                                "vertices": [],
                                                "dwell_limit_minutes": 60,
                                                "stop_limit_minutes": null,
                                                "gps_tolerance_m": null,
                                                "fuel_drop_percent": null,
                                                "fuel_drop_litres": null,
                                                "planned_stops": [],
                                                "active_from": null,
                                                "active_until": null,
                                                "group": null,
                                                "events_enabled": true,
                                                "scope": {
                                                    "kind": "all",
                                                    "vehicle_uuids": []
                                                },
                                                "version": 3,
                                                "row_version": 7,
                                                "created_at": "2026-03-01T08:30:00Z",
                                                "updated_at": "2026-05-12T11:05:42Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/handover-records": {
            "get": {
                "operationId": "handover_records.index",
                "description": "Lists the records of a vehicle passing from one main driver to the next, newest first, one page at a time (at most 100). A row names the vehicle and the two drivers by uuid, where the record stands, the fuel level, the inspection result and the two confirmations as time and channel; never a name, a note, a finding or who made it. A record whose vehicle or driver is outside the key owner's branch or rights is left out. Requires the key scope `fleet:handover_records:read`.\n\nRequires the key scope `fleet:handover_records:read`.",
                "summary": "List vehicle handover records",
                "tags": [
                    "HandoverRecord"
                ],
                "parameters": [
                    {
                        "name": "vehicle",
                        "in": "query",
                        "description": "Only this vehicle (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "driver",
                        "in": "query",
                        "description": "Only records where this driver hands over or receives (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "state",
                        "in": "query",
                        "description": "Only records in this state: awaiting_inspection, awaiting_outgoing, awaiting_incoming or complete.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of handover records.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "6d1c0b7e-52f4-4c58-8a0e-3f6a9b2d7c10",
                                                    "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                    "outgoing_driver_uuid": "3c1e9a52-8d47-4b6a-a2f0-5e7d9b4c1a44",
                                                    "incoming_driver_uuid": "8a2f4c10-1b3d-4e5f-9a6b-7c8d9e0f1a22",
                                                    "opened_at": "2026-03-01T08:30:00Z",
                                                    "state": "complete",
                                                    "fuel_level": "half",
                                                    "inspection_result": "ok",
                                                    "outgoing_confirmed_at": "2026-03-01T09:00:00Z",
                                                    "outgoing_channel": "app",
                                                    "incoming_confirmed_at": "2026-03-01T09:10:00Z",
                                                    "incoming_channel": "app"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": []
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "page": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "limit": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": "integer"
                                                                                },
                                                                                []
                                                                            ]
                                                                        },
                                                                        "next_cursor": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": [
                                                                                        "string",
                                                                                        "null"
                                                                                    ]
                                                                                },
                                                                                []
                                                                            ]
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "limit",
                                                                        "next_cursor"
                                                                    ],
                                                                    "additionalProperties": []
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timezone": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "page",
                                                        "timezone"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/health": {
            "get": {
                "operationId": "health",
                "description": "Answers 200 with status \"up\" while the service runs. Needs no token and returns no version, environment or data; use it for uptime monitoring.",
                "summary": "Check that the API is up",
                "tags": [
                    "Health"
                ],
                "parameters": [
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The API is up.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "status": "up"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "7f3c9a1e-2b4d-4c8e-9f10-000000000000",
                                                "timestamp": "2026-10-18T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "const": "up"
                                                }
                                            },
                                            "required": [
                                                "status"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": []
            }
        },
        "/roadside/hints": {
            "get": {
                "operationId": "roadside.hints.index",
                "description": "Lists what the platform already knows that justifies a roadside case for one of your vehicles: an open critical defect, a recent accident, a breakdown the market reported, a long standstill. A reason that already has a case is not listed again. Each carries its type, the symptom, the help it needs when known and a short plain label; nothing else. Each kind needs its own read scope on the key (`defects:read` for a defect, `trips:read` for a standstill, `alerts:read` for an accident) and the owner's own right to that kind; a market breakdown is not offered here. A vehicle of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `assistance:cases:read`.",
                "summary": "List the reasons to open a roadside case",
                "tags": [
                    "Hint"
                ],
                "parameters": [
                    {
                        "name": "vehicle_uuid",
                        "in": "query",
                        "required": true,
                        "description": "The vehicle whose reasons to read.",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        },
                        "example": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The reasons, possibly none.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "type": "critical_defect",
                                                    "symptom": "other",
                                                    "need": null,
                                                    "label": "A critical defect is open on this vehicle."
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/ModelNotFoundException"
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/reports/impact": {
            "get": {
                "operationId": "reports.impact",
                "description": "The change the platform made over a period against a baseline period (the same length before it, unless you give one): fuel per 100 km, idling, driving events, roadside help and the fuel saved, metric by metric, each with its evidence or the named reason it is not available. The maintenance cost, the camera metrics and the money of the fuel saved appear only for a key whose owner holds the matching right. The period is required and at most 366 days. Never a driver.\n\nRequires the key scope `reporting:reports_impact:read`.",
                "summary": "Read the impact report",
                "tags": [
                    "ImpactReport"
                ],
                "parameters": [
                    {
                        "name": "from",
                        "in": "query",
                        "required": true,
                        "description": "Start of the period, ISO 8601 with an offset.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "required": true,
                        "description": "End of the period, after from and at most 366 days later.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "baseline_from",
                        "in": "query",
                        "description": "Start of the baseline period; give it with baseline_to or neither.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "baseline_to",
                        "in": "query",
                        "description": "End of the baseline period.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "vehicle",
                        "in": "query",
                        "description": "Only this vehicle (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The period against its baseline, one entry per metric; a metric the plan or the key owner's rights do not cover is absent.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "period": {
                                                    "from": "2026-05-01T00:00:00Z",
                                                    "to": "2026-06-01T00:00:00Z"
                                                },
                                                "vehicles": 24,
                                                "metrics": [
                                                    {
                                                        "key": "fuel_per_100_km",
                                                        "unit": "l/100km",
                                                        "period": {
                                                            "value": 12.4,
                                                            "gap": null,
                                                            "evidence": 18200
                                                        },
                                                        "baseline": {
                                                            "value": 13.1,
                                                            "gap": null,
                                                            "evidence": 17650
                                                        },
                                                        "change_percent": -5.3,
                                                        "improved": true
                                                    }
                                                ],
                                                "fuel_saved_litres": 1280,
                                                "baseline": {
                                                    "from": "2026-04-01T00:00:00Z",
                                                    "to": "2026-05-01T00:00:00Z"
                                                }
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "additionalProperties": []
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "type": "string"
                                                        },
                                                        "timestamp": {
                                                            "type": "string"
                                                        },
                                                        "timezone": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "timezone"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "period": {
                                                            "type": "object",
                                                            "properties": {
                                                                "from": {
                                                                    "type": "string"
                                                                },
                                                                "to": {
                                                                    "type": "string"
                                                                }
                                                            },
                                                            "required": [
                                                                "from",
                                                                "to"
                                                            ]
                                                        },
                                                        "metrics": {
                                                            "type": "array",
                                                            "items": {
                                                                "type": "string"
                                                            },
                                                            "minItems": 0,
                                                            "maxItems": 0
                                                        }
                                                    },
                                                    "required": [
                                                        "period",
                                                        "metrics"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "type": "string"
                                                        },
                                                        "timestamp": {
                                                            "type": "string"
                                                        },
                                                        "timezone": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "timezone"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/incomes": {
            "get": {
                "operationId": "incomes.index",
                "description": "Lists your company's vehicle incomes, oldest first, one page at a time. Each carries the vehicle and branch by uuid, type, date, amount in minor units, payer and reference, which are free text as your staff typed them; notes and attached files are never shown. A branch-limited key sees only the incomes recorded under its own branch: the other record types follow the vehicle's current branch, so when a vehicle moves its old incomes stay with the old branch.\n\nRequires the key scope `incomes:read`.",
                "summary": "List incomes",
                "tags": [
                    "Income"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only incomes in this state: active or voided. Voided incomes are left out unless you ask for them.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "voided"
                    },
                    {
                        "name": "vehicle",
                        "in": "query",
                        "description": "Only the vehicle incomes of this vehicle (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "branch",
                        "in": "query",
                        "description": "Only incomes of this branch (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only vehicle incomes changed at or after this moment (ISO 8601 with an offset, e.g. 2026-05-01T00:00:00Z).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of vehicle incomes.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "7e1c4a92-3d58-4f06-a9b3-2b6d8e0f5c14",
                                                    "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                    "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                    "income_type_code": "rental",
                                                    "earned_on": "2026-05-12",
                                                    "amount_minor": 34250,
                                                    "currency": "SAR",
                                                    "payer": "Al Noor Rentals",
                                                    "reference": "RCPT-20481",
                                                    "voided_at": null,
                                                    "created_at": "2026-05-12T12:00:00Z",
                                                    "updated_at": "2026-05-12T12:00:00Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "post": {
                "operationId": "incomes.record",
                "description": "Records an income on one of your company's vehicles, as the panel does: its type, the day it was spent (not in the future), the amount in minor units and the supplier, reference and note. The company's rules apply exactly as in the panel. A driver and a file cannot be sent. Send an Idempotency-Key header so a retry does not record it twice. Requires the key scope `fleet:incomes:write`.\n\nRequires the key scope `fleet:incomes:write`.",
                "summary": "Record a vehicle income",
                "tags": [
                    "IncomeWrite"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/RecordIncomeRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "vehicle": {
                                                "type": "string",
                                                "format": "uuid",
                                                "description": "The vehicle, by its uuid.",
                                                "examples": [
                                                    "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11"
                                                ]
                                            },
                                            "income_type_code": {
                                                "type": "string",
                                                "description": "The code of an active income type.",
                                                "examples": [
                                                    "tolls"
                                                ]
                                            },
                                            "earned_on": {
                                                "type": "string",
                                                "format": "date",
                                                "description": "The day it was earned, Y-m-d.",
                                                "examples": [
                                                    "2026-05-12"
                                                ]
                                            },
                                            "amount_minor": {
                                                "type": "integer",
                                                "description": "The amount in the currency's minor unit, greater than zero.",
                                                "examples": [
                                                    34250
                                                ]
                                            },
                                            "currency": {
                                                "type": "string",
                                                "description": "A three-letter code the company has enabled; the company's default when left out.",
                                                "examples": [
                                                    "SAR"
                                                ]
                                            },
                                            "payer": {
                                                "type": "string",
                                                "description": "Who paid, plain text.",
                                                "examples": [
                                                    "Al Noor Rentals"
                                                ]
                                            },
                                            "reference": {
                                                "type": "string",
                                                "description": "The receipt or invoice number, plain text.",
                                                "examples": [
                                                    "INV-20481"
                                                ]
                                            },
                                            "note": {
                                                "type": "string",
                                                "description": "A note for your staff, plain text.",
                                                "examples": [
                                                    "Paid in cash"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "vehicle",
                                            "income_type_code",
                                            "earned_on",
                                            "amount_minor"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The income that was recorded.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "7e1c4a92-3d58-4f06-a9b3-2b6d8e0f5c14",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                "income_type_code": "rental",
                                                "earned_on": "2026-05-12",
                                                "amount_minor": 34250,
                                                "currency": "SAR",
                                                "payer": "Al Noor Rentals",
                                                "reference": "RCPT-20481",
                                                "voided_at": null,
                                                "created_at": "2026-05-12T12:00:00Z",
                                                "updated_at": "2026-05-12T12:00:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uuid": {
                                                    "type": "string"
                                                },
                                                "vehicle_uuid": {
                                                    "type": "string"
                                                },
                                                "branch_uuid": {
                                                    "type": "string"
                                                },
                                                "income_type_code": {
                                                    "type": "string"
                                                },
                                                "earned_on": {
                                                    "type": "string"
                                                },
                                                "amount_minor": {
                                                    "type": "string"
                                                },
                                                "currency": {
                                                    "type": "string"
                                                },
                                                "payer": {
                                                    "type": "string"
                                                },
                                                "reference": {
                                                    "type": "string"
                                                },
                                                "voided_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "uuid",
                                                "vehicle_uuid",
                                                "branch_uuid",
                                                "income_type_code",
                                                "earned_on",
                                                "amount_minor",
                                                "currency",
                                                "payer",
                                                "reference",
                                                "voided_at",
                                                "created_at",
                                                "updated_at"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/incomes/{uuid}": {
            "get": {
                "operationId": "incomes.show",
                "description": "Reads one of your company's vehicle incomes by its uuid. A record of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `incomes:read`.",
                "summary": "Read an income",
                "tags": [
                    "Income"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The income.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "7e1c4a92-3d58-4f06-a9b3-2b6d8e0f5c14",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                "income_type_code": "rental",
                                                "earned_on": "2026-05-12",
                                                "amount_minor": 34250,
                                                "currency": "SAR",
                                                "payer": "Al Noor Rentals",
                                                "reference": "RCPT-20481",
                                                "voided_at": null,
                                                "created_at": "2026-05-12T12:00:00Z",
                                                "updated_at": "2026-05-12T12:00:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "additionalProperties": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/incomes/{uuid}/void": {
            "post": {
                "operationId": "incomes.void",
                "description": "Voids an income of your company with a reason of at least ten characters; the row stays, frozen, and is shown as voided. Send the `row_version` you read: an income changed meanwhile answers 409. Requires the key scope `fleet:incomes:write`.\n\nRequires the key scope `fleet:incomes:write`.",
                "summary": "Void a vehicle income",
                "tags": [
                    "IncomeWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/VoidIncomeRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The version of the income you read.",
                                                "examples": [
                                                    1
                                                ]
                                            },
                                            "reason": {
                                                "type": "string",
                                                "description": "Why it is voided, 10 to 1000 characters of plain text.",
                                                "examples": [
                                                    "Recorded twice by mistake"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version",
                                            "reason"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The income, now voided.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "7e1c4a92-3d58-4f06-a9b3-2b6d8e0f5c14",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                "income_type_code": "rental",
                                                "earned_on": "2026-05-12",
                                                "amount_minor": 34250,
                                                "currency": "SAR",
                                                "payer": "Al Noor Rentals",
                                                "reference": "RCPT-20481",
                                                "voided_at": null,
                                                "created_at": "2026-05-12T12:00:00Z",
                                                "updated_at": "2026-05-12T12:00:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "vehicle_uuid": {
                                                            "type": "string"
                                                        },
                                                        "branch_uuid": {
                                                            "type": "string"
                                                        },
                                                        "income_type_code": {
                                                            "type": "string"
                                                        },
                                                        "earned_on": {
                                                            "type": "string"
                                                        },
                                                        "amount_minor": {
                                                            "type": "string"
                                                        },
                                                        "currency": {
                                                            "type": "string"
                                                        },
                                                        "payer": {
                                                            "type": "string"
                                                        },
                                                        "reference": {
                                                            "type": "string"
                                                        },
                                                        "voided_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "vehicle_uuid",
                                                        "branch_uuid",
                                                        "income_type_code",
                                                        "earned_on",
                                                        "amount_minor",
                                                        "currency",
                                                        "payer",
                                                        "reference",
                                                        "voided_at",
                                                        "created_at",
                                                        "updated_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/telemetry/ingest": {
            "post": {
                "operationId": "telemetry.ingest",
                "description": "Stores one batch of readings from your tracking platform. A 202 means the batch is stored, not yet placed on a vehicle: matching to vehicles and checks run afterwards, and readings for an unknown device wait for review. Each observation names its vehicle by imei or vehicle_external_id and its time by observed_at (ISO 8601 UTC) or observed_at_epoch_ms. An empty batch or one larger than your agreed size answers 422 batch_too_large; invalid fields answer 422 validation_failed with one detail per field; a body over the size limit answers 413 payload_too_large. Send in batches: each source key may make a limited number of requests a minute (120 by default) and each IP address another (300 by default, shared by all your keys from it), so one reading per request is soon refused with 429. Collect the readings of every vehicle and send one batch every 15 seconds, or when it reaches your batch size (500 readings by default), whichever comes first.\n\nRequires a source token with the ability `telemetry:ingest`.",
                "summary": "Send vehicle observations",
                "tags": [
                    "Ingest"
                ],
                "parameters": [
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "description": "Optional; up to 100 of A-Z a-z 0-9 . _ : -. The same key with the same body answers 200 with duplicate true; with a different body, 409 idempotency_conflict.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "batch-2026-10-18-0001"
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "batch_id": {
                                        "type": "string",
                                        "description": "Optional id of this batch in your system.",
                                        "examples": [
                                            "batch-2026-10-18-0001"
                                        ]
                                    },
                                    "observations": {
                                        "type": "array",
                                        "description": "One or more readings. Fields: imei or vehicle_external_id; observed_at or observed_at_epoch_ms; latitude, longitude and speed (required); optional heading, speed_unit (kmh, knots, mph), ignition, gps_valid (false: the receiver reports the fix invalid; it is kept but never sent), weight_kg, weight_mv, temperature_c, humidity_pct, fuel_level_pct, driver_external_id, event_id, native_event_code.",
                                        "examples": [
                                            [
                                                {
                                                    "imei": "000000000000000",
                                                    "observed_at": "2026-10-18T09:00:00Z",
                                                    "latitude": 24.7136,
                                                    "longitude": 46.6753,
                                                    "speed": 62.5,
                                                    "speed_unit": "kmh",
                                                    "heading": 270,
                                                    "ignition": true
                                                }
                                            ]
                                        ],
                                        "items": []
                                    }
                                },
                                "required": [
                                    "observations"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The same batch was already stored; nothing new is written.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "receipt_id": "00000000-0000-4000-8000-000000000001",
                                                "idempotency_key": "batch-2026-10-18-0001",
                                                "item_count": 1,
                                                "duplicate": true,
                                                "received_at": "2026-10-18T09:00:01.000Z",
                                                "units": {
                                                    "speed": null,
                                                    "confirmed": false
                                                }
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "7f3c9a1e-2b4d-4c8e-9f10-000000000000",
                                                "timestamp": "2026-10-18T09:05:00Z"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "202": {
                        "description": "The batch is stored.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "receipt_id": "00000000-0000-4000-8000-000000000001",
                                                "idempotency_key": "batch-2026-10-18-0001",
                                                "item_count": 1,
                                                "duplicate": false,
                                                "received_at": "2026-10-18T09:00:01.000Z",
                                                "units": {
                                                    "speed": null,
                                                    "confirmed": false
                                                }
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "7f3c9a1e-2b4d-4c8e-9f10-000000000000",
                                                "timestamp": "2026-10-18T09:00:01Z"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the source token is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string",
                                    "examples": [
                                        {
                                            "success": false,
                                            "data": null,
                                            "error": {
                                                "code": "unauthenticated",
                                                "message": "Authentication is required."
                                            },
                                            "meta": {
                                                "request_id": "7f3c9a1e-2b4d-4c8e-9f10-000000000000",
                                                "timestamp": "2026-10-18T09:00:01Z"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "idempotency_conflict: the Idempotency-Key was already used with a different body.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string",
                                    "examples": [
                                        {
                                            "success": false,
                                            "data": null,
                                            "error": {
                                                "code": "idempotency_conflict",
                                                "message": "The idempotency key was already used with a different body."
                                            },
                                            "meta": {
                                                "request_id": "7f3c9a1e-2b4d-4c8e-9f10-000000000000",
                                                "timestamp": "2026-10-18T09:00:01Z"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "payload_too_large: the request body is over the size limit.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string",
                                    "examples": [
                                        {
                                            "success": false,
                                            "data": null,
                                            "error": {
                                                "code": "payload_too_large",
                                                "message": "The request body is too large."
                                            },
                                            "meta": {
                                                "request_id": "7f3c9a1e-2b4d-4c8e-9f10-000000000000",
                                                "timestamp": "2026-10-18T09:00:01Z"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "415": {
                        "description": "unsupported_media_type: send Content-Type application/json.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string",
                                    "examples": [
                                        {
                                            "success": false,
                                            "data": null,
                                            "error": {
                                                "code": "unsupported_media_type",
                                                "message": "The request body must be application/json."
                                            },
                                            "meta": {
                                                "request_id": "7f3c9a1e-2b4d-4c8e-9f10-000000000000",
                                                "timestamp": "2026-10-18T09:00:01Z"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed (one detail per invalid field) or batch_too_large.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string",
                                    "examples": [
                                        {
                                            "success": false,
                                            "data": null,
                                            "error": {
                                                "code": "validation_failed",
                                                "message": "The request contains invalid fields.",
                                                "details": [
                                                    {
                                                        "field": "observations.0.latitude",
                                                        "code": "out_of_range",
                                                        "message": "This value is out of range."
                                                    }
                                                ]
                                            },
                                            "meta": {
                                                "request_id": "7f3c9a1e-2b4d-4c8e-9f10-000000000000",
                                                "timestamp": "2026-10-18T09:00:01Z"
                                            }
                                        },
                                        {
                                            "success": false,
                                            "data": null,
                                            "error": {
                                                "code": "batch_too_large",
                                                "message": "The batch is empty or has more observations than allowed.",
                                                "details": [
                                                    {
                                                        "field": "observations",
                                                        "code": "out_of_range",
                                                        "message": "This value is out of range."
                                                    }
                                                ]
                                            },
                                            "meta": {
                                                "request_id": "7f3c9a1e-2b4d-4c8e-9f10-000000000000",
                                                "timestamp": "2026-10-18T09:00:01Z"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sourceToken": []
                    }
                ]
            }
        },
        "/inspections": {
            "get": {
                "operationId": "inspections.index",
                "description": "Lists your company's vehicle inspections, oldest first, one page at a time. Each carries the vehicle and driver by uuid, when it was done, the odometer and the result; inspectors' notes are never shown. A branch-limited key sees only the inspections of the vehicles that are currently in its branch.\n\nRequires the key scope `inspections:read`.",
                "summary": "List inspections",
                "tags": [
                    "Inspection"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only inspections with this result: passed, passed_with_findings or failed.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "failed"
                    },
                    {
                        "name": "vehicle",
                        "in": "query",
                        "description": "Only the vehicle inspections of this vehicle (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only vehicle inspections changed at or after this moment (ISO 8601 with an offset, e.g. 2026-05-01T00:00:00Z).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of vehicle inspections.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "4e2b7c10-9a35-4d68-b1f4-2c8a6e0d5b77",
                                                    "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                    "driver_uuid": "3c1e9a52-8d47-4b6a-a2f0-5e7d9b4c1a44",
                                                    "result": "passed_with_findings",
                                                    "odometer_km": 125340.5,
                                                    "performed_at": "2026-05-12T07:45:00Z",
                                                    "created_at": "2026-05-12T07:50:12Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/inspections/{uuid}": {
            "get": {
                "operationId": "inspections.show",
                "description": "Reads one of your company's vehicle inspections by its uuid. A record of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `inspections:read`.",
                "summary": "Read an inspection",
                "tags": [
                    "Inspection"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The inspection.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "4e2b7c10-9a35-4d68-b1f4-2c8a6e0d5b77",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "driver_uuid": "3c1e9a52-8d47-4b6a-a2f0-5e7d9b4c1a44",
                                                "result": "passed_with_findings",
                                                "odometer_km": 125340.5,
                                                "performed_at": "2026-05-12T07:45:00Z",
                                                "created_at": "2026-05-12T07:50:12Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "additionalProperties": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/inspections/schedules": {
            "get": {
                "operationId": "inspections.schedules.index",
                "description": "Lists your company's inspection schedules («this checklist every N days» for a vehicle), oldest first, one page at a time. Each carries the vehicle by uuid, the checklist by its code (a ready one) or uuid (your own), the interval in days, the status, and for an active schedule where the next inspection stands: ok, due_soon or overdue. A branch-limited key sees only the schedules of the vehicles that are currently in its branch.\n\nRequires the key scope `inspections:read`.",
                "summary": "List inspection schedules",
                "tags": [
                    "InspectionSchedule"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only schedules with this status: active, paused or retired. Retired ones are listed only when asked for.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "active"
                    },
                    {
                        "name": "vehicle",
                        "in": "query",
                        "description": "Only the schedules of this vehicle (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only schedules changed at or after this moment (ISO 8601 with an offset, e.g. 2026-05-01T00:00:00Z).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of inspection schedules.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "6d2f8b13-7a54-4c90-8e21-1b3c5d7e9f02",
                                                    "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                    "checklist_code": "pre_trip",
                                                    "checklist_uuid": null,
                                                    "every_days": 30,
                                                    "baseline_on": "2026-05-01",
                                                    "status": "active",
                                                    "state": "ok",
                                                    "last_inspection_on": "2026-05-12",
                                                    "next_inspection_on": "2026-06-11",
                                                    "created_at": "2026-05-01T08:00:00Z",
                                                    "updated_at": "2026-05-12T09:10:00Z",
                                                    "row_version": 2
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "post": {
                "operationId": "inspections.schedules.create",
                "description": "Schedules a checklist on one of your company's vehicles every N days, as the panel does: the vehicle by uuid, the checklist by `checklist_code` (a ready one, from the inspection templates) or `checklist_uuid` (one of your own, never both), and `every_days`. The days count from the vehicle's last inspection with that checklist, or from today. A vehicle holds one live schedule per checklist. At most 20 schedules an hour for one vehicle. A vehicle of another company or branch answers 404 exactly like one that does not exist. Requires the key scope `fleet:inspection_schedules:write` and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:inspection_schedules:write`.",
                "summary": "Create an inspection schedule",
                "tags": [
                    "InspectionScheduleWrite"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/CreateInspectionScheduleRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "vehicle": {
                                                "type": "string",
                                                "format": "uuid",
                                                "description": "The vehicle, by its uuid.",
                                                "examples": [
                                                    "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11"
                                                ]
                                            },
                                            "checklist_code": {
                                                "type": "string",
                                                "description": "The code of a ready checklist; send this or checklist_uuid.",
                                                "examples": [
                                                    "pre_trip"
                                                ]
                                            },
                                            "checklist_uuid": {
                                                "type": "string",
                                                "format": "uuid",
                                                "description": "The uuid of one of your company's own checklists; send this or checklist_code."
                                            },
                                            "every_days": {
                                                "type": "integer",
                                                "description": "Days between two inspections, 1 to 3650.",
                                                "examples": [
                                                    30
                                                ]
                                            }
                                        },
                                        "required": [
                                            "vehicle",
                                            "every_days"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The schedule that was created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "6d2f8b13-7a54-4c90-8e21-1b3c5d7e9f02",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "checklist_code": "pre_trip",
                                                "checklist_uuid": null,
                                                "every_days": 30,
                                                "baseline_on": "2026-05-01",
                                                "status": "active",
                                                "state": "ok",
                                                "last_inspection_on": "2026-05-12",
                                                "next_inspection_on": "2026-06-11",
                                                "created_at": "2026-05-01T08:00:00Z",
                                                "updated_at": "2026-05-12T09:10:00Z",
                                                "row_version": 2
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uuid": {
                                                    "type": "string"
                                                },
                                                "vehicle_uuid": {
                                                    "type": "string"
                                                },
                                                "checklist_code": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "checklist_uuid": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "every_days": {
                                                    "type": "string"
                                                },
                                                "baseline_on": {
                                                    "type": "string"
                                                },
                                                "status": {
                                                    "type": "string"
                                                },
                                                "state": {
                                                    "type": "string"
                                                },
                                                "last_inspection_on": {
                                                    "type": "string"
                                                },
                                                "next_inspection_on": {
                                                    "type": "string"
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "row_version": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "uuid",
                                                "vehicle_uuid",
                                                "checklist_code",
                                                "checklist_uuid",
                                                "every_days",
                                                "baseline_on",
                                                "status",
                                                "state",
                                                "last_inspection_on",
                                                "next_inspection_on",
                                                "created_at",
                                                "updated_at",
                                                "row_version"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/inspections/schedules/{uuid}": {
            "get": {
                "operationId": "inspections.schedules.show",
                "description": "Reads one of your company's inspection schedules by its uuid. A record of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `inspections:read`.",
                "summary": "Read an inspection schedule",
                "tags": [
                    "InspectionSchedule"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The inspection schedule.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "6d2f8b13-7a54-4c90-8e21-1b3c5d7e9f02",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "checklist_code": "pre_trip",
                                                "checklist_uuid": null,
                                                "every_days": 30,
                                                "baseline_on": "2026-05-01",
                                                "status": "active",
                                                "state": "ok",
                                                "last_inspection_on": "2026-05-12",
                                                "next_inspection_on": "2026-06-11",
                                                "created_at": "2026-05-01T08:00:00Z",
                                                "updated_at": "2026-05-12T09:10:00Z",
                                                "row_version": 2
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "additionalProperties": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "patch": {
                "operationId": "inspections.schedules.update",
                "description": "Changes the days between two inspections of a schedule that has not ended. Send the `row_version` you read: a schedule changed meanwhile or already ended answers 409. Requires the key scope `fleet:inspection_schedules:write` and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:inspection_schedules:write`.",
                "summary": "Change an inspection schedule",
                "tags": [
                    "InspectionScheduleWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/UpdateInspectionScheduleRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The version of the schedule you read.",
                                                "examples": [
                                                    2
                                                ]
                                            },
                                            "every_days": {
                                                "type": "integer",
                                                "description": "Days between two inspections, 1 to 3650.",
                                                "examples": [
                                                    45
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version",
                                            "every_days"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The schedule after the change.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "6d2f8b13-7a54-4c90-8e21-1b3c5d7e9f02",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "checklist_code": "pre_trip",
                                                "checklist_uuid": null,
                                                "every_days": 30,
                                                "baseline_on": "2026-05-01",
                                                "status": "active",
                                                "state": "ok",
                                                "last_inspection_on": "2026-05-12",
                                                "next_inspection_on": "2026-06-11",
                                                "created_at": "2026-05-01T08:00:00Z",
                                                "updated_at": "2026-05-12T09:10:00Z",
                                                "row_version": 2
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "vehicle_uuid": {
                                                            "type": "string"
                                                        },
                                                        "checklist_code": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "checklist_uuid": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "every_days": {
                                                            "type": "string"
                                                        },
                                                        "baseline_on": {
                                                            "type": "string"
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "state": {
                                                            "type": "string"
                                                        },
                                                        "last_inspection_on": {
                                                            "type": "string"
                                                        },
                                                        "next_inspection_on": {
                                                            "type": "string"
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "row_version": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "vehicle_uuid",
                                                        "checklist_code",
                                                        "checklist_uuid",
                                                        "every_days",
                                                        "baseline_on",
                                                        "status",
                                                        "state",
                                                        "last_inspection_on",
                                                        "next_inspection_on",
                                                        "created_at",
                                                        "updated_at",
                                                        "row_version"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/inspections/schedules/{uuid}/pause": {
            "post": {
                "operationId": "inspections.schedules.pause",
                "description": "Stops an active schedule from raising notices until it is resumed. Send the `row_version` you read; a schedule that is already paused or ended answers 409. Requires the key scope `fleet:inspection_schedules:write` and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:inspection_schedules:write`.",
                "summary": "Pause an inspection schedule",
                "tags": [
                    "InspectionScheduleWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/InspectionScheduleStatusRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The version of the schedule you read.",
                                                "examples": [
                                                    2
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The schedule, now paused.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "6d2f8b13-7a54-4c90-8e21-1b3c5d7e9f02",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "checklist_code": "pre_trip",
                                                "checklist_uuid": null,
                                                "every_days": 30,
                                                "baseline_on": "2026-05-01",
                                                "status": "active",
                                                "state": "ok",
                                                "last_inspection_on": "2026-05-12",
                                                "next_inspection_on": "2026-06-11",
                                                "created_at": "2026-05-01T08:00:00Z",
                                                "updated_at": "2026-05-12T09:10:00Z",
                                                "row_version": 2
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "vehicle_uuid": {
                                                            "type": "string"
                                                        },
                                                        "checklist_code": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "checklist_uuid": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "every_days": {
                                                            "type": "string"
                                                        },
                                                        "baseline_on": {
                                                            "type": "string"
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "state": {
                                                            "type": "string"
                                                        },
                                                        "last_inspection_on": {
                                                            "type": "string"
                                                        },
                                                        "next_inspection_on": {
                                                            "type": "string"
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "row_version": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "vehicle_uuid",
                                                        "checklist_code",
                                                        "checklist_uuid",
                                                        "every_days",
                                                        "baseline_on",
                                                        "status",
                                                        "state",
                                                        "last_inspection_on",
                                                        "next_inspection_on",
                                                        "created_at",
                                                        "updated_at",
                                                        "row_version"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/inspections/schedules/{uuid}/resume": {
            "post": {
                "operationId": "inspections.schedules.resume",
                "description": "Makes a paused schedule active again. Send the `row_version` you read; a schedule that is already active or ended answers 409. Requires the key scope `fleet:inspection_schedules:write` and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:inspection_schedules:write`.",
                "summary": "Resume an inspection schedule",
                "tags": [
                    "InspectionScheduleWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/InspectionScheduleStatusRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The version of the schedule you read.",
                                                "examples": [
                                                    3
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The schedule, now active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "6d2f8b13-7a54-4c90-8e21-1b3c5d7e9f02",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "checklist_code": "pre_trip",
                                                "checklist_uuid": null,
                                                "every_days": 30,
                                                "baseline_on": "2026-05-01",
                                                "status": "active",
                                                "state": "ok",
                                                "last_inspection_on": "2026-05-12",
                                                "next_inspection_on": "2026-06-11",
                                                "created_at": "2026-05-01T08:00:00Z",
                                                "updated_at": "2026-05-12T09:10:00Z",
                                                "row_version": 2
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "vehicle_uuid": {
                                                            "type": "string"
                                                        },
                                                        "checklist_code": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "checklist_uuid": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "every_days": {
                                                            "type": "string"
                                                        },
                                                        "baseline_on": {
                                                            "type": "string"
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "state": {
                                                            "type": "string"
                                                        },
                                                        "last_inspection_on": {
                                                            "type": "string"
                                                        },
                                                        "next_inspection_on": {
                                                            "type": "string"
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "row_version": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "vehicle_uuid",
                                                        "checklist_code",
                                                        "checklist_uuid",
                                                        "every_days",
                                                        "baseline_on",
                                                        "status",
                                                        "state",
                                                        "last_inspection_on",
                                                        "next_inspection_on",
                                                        "created_at",
                                                        "updated_at",
                                                        "row_version"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/inspections/schedules/{uuid}/retire": {
            "post": {
                "operationId": "inspections.schedules.retire",
                "description": "Ends a schedule for good: it stays in the record, sends no more notices and cannot be changed, paused or resumed afterwards. Send the `row_version` you read and `confirm` set to true. Requires the key scope `fleet:inspection_schedules:write` and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:inspection_schedules:write`.",
                "summary": "End an inspection schedule",
                "tags": [
                    "InspectionScheduleWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/InspectionScheduleStatusRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The version of the schedule you read.",
                                                "examples": [
                                                    3
                                                ]
                                            },
                                            "confirm": {
                                                "type": "boolean",
                                                "description": "Must be true: ending cannot be undone.",
                                                "examples": [
                                                    true
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version",
                                            "confirm"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The schedule, now ended.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "6d2f8b13-7a54-4c90-8e21-1b3c5d7e9f02",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "checklist_code": "pre_trip",
                                                "checklist_uuid": null,
                                                "every_days": 30,
                                                "baseline_on": "2026-05-01",
                                                "status": "active",
                                                "state": "ok",
                                                "last_inspection_on": "2026-05-12",
                                                "next_inspection_on": "2026-06-11",
                                                "created_at": "2026-05-01T08:00:00Z",
                                                "updated_at": "2026-05-12T09:10:00Z",
                                                "row_version": 2
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "vehicle_uuid": {
                                                            "type": "string"
                                                        },
                                                        "checklist_code": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "checklist_uuid": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "every_days": {
                                                            "type": "string"
                                                        },
                                                        "baseline_on": {
                                                            "type": "string"
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "state": {
                                                            "type": "string"
                                                        },
                                                        "last_inspection_on": {
                                                            "type": "string"
                                                        },
                                                        "next_inspection_on": {
                                                            "type": "string"
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "row_version": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "vehicle_uuid",
                                                        "checklist_code",
                                                        "checklist_uuid",
                                                        "every_days",
                                                        "baseline_on",
                                                        "status",
                                                        "state",
                                                        "last_inspection_on",
                                                        "next_inspection_on",
                                                        "created_at",
                                                        "updated_at",
                                                        "row_version"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/journeys": {
            "get": {
                "operationId": "journeys.index",
                "description": "Lists the closed journeys of your vehicles that began between from (included) and to (excluded), oldest first, at most 31 days at a time, one page at a time. A journey is named by its vehicle and its start time. A branch-limited key sees only its own branch. Times are UTC; meta.timezone names the platform time zone.\n\nRequires the key scope `positions:read`.",
                "summary": "List journeys",
                "tags": [
                    "Journey"
                ],
                "parameters": [
                    {
                        "name": "from",
                        "in": "query",
                        "required": true,
                        "description": "Start of the window, ISO 8601 with an offset (e.g. 2026-06-01T00:00:00Z); included.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "required": true,
                        "description": "End of the window, after from and at most 31 days later; excluded.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "vehicle",
                        "in": "query",
                        "description": "Only the journeys of this vehicle (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of journeys.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                    "driver_uuid": "3c1e9a52-8d47-4b6a-a2f0-5e7d9b4c1a44",
                                                    "started_at": "2026-06-01T05:10:00Z",
                                                    "ended_at": "2026-06-01T07:42:30Z",
                                                    "distance_m": 184200,
                                                    "max_speed_kmh": 96,
                                                    "idle_seconds": 420,
                                                    "start_latitude": 24.7136,
                                                    "start_longitude": 46.6753,
                                                    "end_latitude": 26.4207,
                                                    "end_longitude": 50.0888
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/leases": {
            "get": {
                "operationId": "leases.index",
                "description": "Lists the leases of your company's vehicles, one page at a time (at most 100): the vehicle by uuid, the lessor, the contract number, the dates, the monthly cost in minor units with its currency, and who looks after maintenance. Requires the key scope `fleet:leases:read`; money, so no app session carries it.\n\nRequires the key scope `fleet:leases:read`.",
                "summary": "List vehicle leases",
                "tags": [
                    "Lease"
                ],
                "parameters": [
                    {
                        "name": "vehicle",
                        "in": "query",
                        "description": "Only this vehicle (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "active",
                        "in": "query",
                        "description": "true for the leases running today.",
                        "schema": {
                            "type": "boolean"
                        }
                    },
                    {
                        "name": "ending_within_days",
                        "in": "query",
                        "description": "Only leases that end within this many days from today (1 to 366).",
                        "schema": {
                            "type": "integer"
                        },
                        "example": 90
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of leases.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "6d2f8a14-3b7e-4c59-8a21-9e0c5d7b1f33",
                                                    "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                    "lessor_name": "Gulf Leasing Co.",
                                                    "contract_number": "LS-2026-0412",
                                                    "starts_on": "2026-01-01",
                                                    "ends_on": "2028-12-31",
                                                    "monthly_cost_minor": 450000,
                                                    "currency": "SAR",
                                                    "maintenance_responsibility": "lessor"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": []
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "page": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "limit": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": "integer"
                                                                                },
                                                                                []
                                                                            ]
                                                                        },
                                                                        "next_cursor": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": [
                                                                                        "string",
                                                                                        "null"
                                                                                    ]
                                                                                },
                                                                                []
                                                                            ]
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "limit",
                                                                        "next_cursor"
                                                                    ],
                                                                    "additionalProperties": []
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timezone": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "page",
                                                        "timezone"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/leases/{uuid}": {
            "get": {
                "operationId": "leases.show",
                "description": "Reads one lease by its uuid. A lease of another company, outside the key owner's branch, or that does not exist answers 404 alike. Requires the key scope `fleet:leases:read`.\n\nRequires the key scope `fleet:leases:read`.",
                "summary": "Read a vehicle lease",
                "tags": [
                    "Lease"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The lease.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "6d2f8a14-3b7e-4c59-8a21-9e0c5d7b1f33",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "lessor_name": "Gulf Leasing Co.",
                                                "contract_number": "LS-2026-0412",
                                                "starts_on": "2026-01-01",
                                                "ends_on": "2028-12-31",
                                                "monthly_cost_minor": 450000,
                                                "currency": "SAR",
                                                "maintenance_responsibility": "lessor"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "vehicle_uuid": {
                                                            "type": "string"
                                                        },
                                                        "lessor_name": {
                                                            "type": "string"
                                                        },
                                                        "contract_number": {
                                                            "type": "string"
                                                        },
                                                        "starts_on": {
                                                            "type": "string"
                                                        },
                                                        "ends_on": {
                                                            "type": "string"
                                                        },
                                                        "monthly_cost_minor": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ]
                                                        },
                                                        "currency": {
                                                            "type": "string"
                                                        },
                                                        "maintenance_responsibility": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "vehicle_uuid",
                                                        "lessor_name",
                                                        "contract_number",
                                                        "starts_on",
                                                        "ends_on",
                                                        "monthly_cost_minor",
                                                        "currency",
                                                        "maintenance_responsibility"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "type": "string"
                                                        },
                                                        "timestamp": {
                                                            "type": "string"
                                                        },
                                                        "timezone": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "timezone"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/legal-operators": {
            "get": {
                "operationId": "legal_operators.index",
                "description": "Lists the active legal operators of your company with the uuid that `legal_operator_uuid` takes when you register a vehicle; no other company's operator is ever shown.\n\nRequires the key scope `vehicles:read`.",
                "summary": "List legal operators",
                "tags": [
                    "LegalOperator"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The active legal operators of the company.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "7a9c3d2e-1b44-4a6f-9c5d-6e8f0a1b2c33",
                                                    "name": "شركة النقل المتحدة"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "uuid": {
                                                        "type": "string"
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    }
                                                },
                                                "required": [
                                                    "uuid",
                                                    "name"
                                                ]
                                            }
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/licences": {
            "get": {
                "operationId": "licences.index",
                "description": "Lists your company's licences, oldest first, one page at a time. Each carries its type (a code of your company's licence types), issuer (free text as typed), holder by uuid and the issue date, expiry date and validity of its current version. The licence number, the evidence file and who registered it are never shown. Archived licences are not shown. A branch-limited key sees only its own branch. updated_since also lists a licence whose current version was renewed or amended, and updated_at then shows that moment; validity moves with the calendar (valid, then expiring, then expired) without any change to the record, so a client that syncs by updated_since should also read the licences it holds by expiry_date or ask with status=expiring or status=expired.\n\nRequires the key scope `licences:read`.",
                "summary": "List licences",
                "tags": [
                    "Licence"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only licences whose current version has this validity: valid, expiring, expired, cancelled, suspended or unknown.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "expiring"
                    },
                    {
                        "name": "vehicle",
                        "in": "query",
                        "description": "Only the licences of this vehicle (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "branch",
                        "in": "query",
                        "description": "Only licences of this branch (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only licences changed at or after this moment (ISO 8601 with an offset, e.g. 2026-05-01T00:00:00Z).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of licences.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "5b8e2d71-6c04-4a39-9e17-3f0a1d6c8b52",
                                                    "licence_type": "vehicle_registration",
                                                    "holder": "vehicle",
                                                    "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                    "driver_uuid": null,
                                                    "operator_uuid": null,
                                                    "issuer": "Traffic Department",
                                                    "issue_date": "2025-03-01",
                                                    "expiry_date": "2027-03-01",
                                                    "validity": "valid",
                                                    "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                    "created_at": "2025-03-02T08:00:00Z",
                                                    "updated_at": "2025-03-02T08:00:00Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/licences/{uuid}": {
            "get": {
                "operationId": "licences.show",
                "description": "Reads one of your company's licences by its uuid. A licence of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `licences:read`.",
                "summary": "Read a licence",
                "tags": [
                    "Licence"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The licence.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "5b8e2d71-6c04-4a39-9e17-3f0a1d6c8b52",
                                                "licence_type": "vehicle_registration",
                                                "holder": "vehicle",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "driver_uuid": null,
                                                "operator_uuid": null,
                                                "issuer": "Traffic Department",
                                                "issue_date": "2025-03-01",
                                                "expiry_date": "2027-03-01",
                                                "validity": "valid",
                                                "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                "created_at": "2025-03-02T08:00:00Z",
                                                "updated_at": "2025-03-02T08:00:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "additionalProperties": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/vehicles/{uuid}/lifecycle": {
            "get": {
                "operationId": "vehicles.lifecycle",
                "description": "The stages of one of your vehicles, oldest first. The deal and the note of a stage appear only when the key's owner holds the finance right, and are left out otherwise; the reading of them is recorded. A vehicle of another company or branch answers 404.\n\nRequires the key scope `lifecycle:read`.",
                "summary": "Read a vehicle's lifecycle",
                "tags": [
                    "Lifecycle"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The stages.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "stages": [
                                                    {
                                                        "stage": "disposed",
                                                        "occurred_on": "2026-11-10",
                                                        "voided": false,
                                                        "note": "Sold at auction",
                                                        "deal": {
                                                            "kind": "sale",
                                                            "counterparty": "Example Trading Co",
                                                            "reference": "INV-77",
                                                            "amount_minor": 800000,
                                                            "currency": "SAR",
                                                            "book_value_minor": 720000
                                                        }
                                                    }
                                                ]
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-14T12:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "stages": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                }
                                            },
                                            "required": [
                                                "stages"
                                            ],
                                            "additionalProperties": {
                                                "type": "string"
                                            }
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "post": {
                "operationId": "vehicles.lifecycle.store",
                "description": "Records the purchase or the in-service stage of one of your vehicles, as the vehicle page does, with the same rights and rules. A purchase may carry the seller, a reference and the price. A sale, a scrapping and a retirement are not accepted here. Needs the Idempotency-Key header.\n\nRequires the key scope `fleet:lifecycle:write`.",
                "summary": "Record a lifecycle stage",
                "tags": [
                    "LifecycleWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/RecordLifecycleStageRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "stage": {
                                                "type": "string",
                                                "description": "acquired or in_service.",
                                                "examples": [
                                                    "acquired"
                                                ]
                                            },
                                            "occurred_on": {
                                                "type": "string",
                                                "format": "date",
                                                "description": "The day, YYYY-MM-DD, not in the future.",
                                                "examples": [
                                                    "2026-01-15"
                                                ]
                                            },
                                            "note": {
                                                "type": "string",
                                                "description": "An optional plain note.",
                                                "examples": [
                                                    "Bought new"
                                                ]
                                            },
                                            "seller": {
                                                "type": "string",
                                                "description": "For a purchase: the seller's name.",
                                                "examples": [
                                                    "Example Motors"
                                                ]
                                            },
                                            "reference": {
                                                "type": "string",
                                                "description": "For a purchase: the invoice or document number.",
                                                "examples": [
                                                    "INV-2026-14"
                                                ]
                                            },
                                            "amount": {
                                                "type": "string",
                                                "description": "For a purchase: the price as a decimal in the currency's major unit; Arabic digits are accepted.",
                                                "examples": [
                                                    "125000.50"
                                                ]
                                            },
                                            "currency": {
                                                "type": "string",
                                                "description": "For a purchase: a three-letter currency code; the platform's default when absent.",
                                                "examples": [
                                                    "SAR"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "stage",
                                            "occurred_on"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The stage that was recorded.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "stage": "acquired",
                                                "occurred_on": "2026-01-15",
                                                "version": 1,
                                                "voided": false
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-14T12:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "stage": {
                                                    "type": "string"
                                                },
                                                "occurred_on": {
                                                    "type": "string"
                                                },
                                                "version": {
                                                    "type": "integer"
                                                },
                                                "voided": {
                                                    "type": "boolean"
                                                },
                                                "deal": {
                                                    "type": "object",
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string"
                                                        },
                                                        "counterparty": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "reference": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "amount_minor": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ]
                                                        },
                                                        "currency": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "kind",
                                                        "counterparty",
                                                        "reference",
                                                        "amount_minor",
                                                        "currency"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "stage",
                                                "occurred_on",
                                                "version",
                                                "voided",
                                                "deal"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/fleet-assets/{uuid}/lifecycle": {
            "get": {
                "operationId": "fleet_assets.lifecycle",
                "description": "The stages of one of your trailers or pieces of equipment, oldest first, with the same rules as a vehicle: the deal and the note appear only for an owner with the finance right and the reading of them is recorded. An asset of another company or branch answers 404.\n\nRequires the key scope `lifecycle:read`.",
                "summary": "Read a fleet asset's lifecycle",
                "tags": [
                    "Lifecycle"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The stages.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "asset_uuid": "9e2b7c14-3d58-4f0a-b6a1-7c4d2e8f5a10",
                                                "stages": [
                                                    {
                                                        "stage": "disposed",
                                                        "occurred_on": "2026-11-10",
                                                        "voided": false,
                                                        "note": "Sold at auction",
                                                        "deal": {
                                                            "kind": "sale",
                                                            "counterparty": "Example Trading Co",
                                                            "reference": "INV-77",
                                                            "amount_minor": 800000,
                                                            "currency": "SAR",
                                                            "book_value_minor": 720000
                                                        }
                                                    }
                                                ]
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-14T12:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "stages": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                }
                                            },
                                            "required": [
                                                "stages"
                                            ],
                                            "additionalProperties": {
                                                "type": "string"
                                            }
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "post": {
                "operationId": "fleet_assets.lifecycle.store",
                "description": "Records the purchase or the in-service stage of one of your trailers or pieces of equipment, as its page does, with the same rights and rules. A sale, a scrapping and a retirement are not accepted here. Needs the Idempotency-Key header.\n\nRequires the key scope `fleet:lifecycle:write`.",
                "summary": "Record a fleet asset lifecycle stage",
                "tags": [
                    "LifecycleWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/RecordLifecycleStageRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "stage": {
                                                "type": "string",
                                                "description": "acquired or in_service.",
                                                "examples": [
                                                    "acquired"
                                                ]
                                            },
                                            "occurred_on": {
                                                "type": "string",
                                                "format": "date",
                                                "description": "The day, YYYY-MM-DD, not in the future.",
                                                "examples": [
                                                    "2026-01-15"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "stage",
                                            "occurred_on"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The stage that was recorded.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "stage": "acquired",
                                                "occurred_on": "2026-01-15",
                                                "version": 1,
                                                "voided": false
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-14T12:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "stage": {
                                                    "type": "string"
                                                },
                                                "occurred_on": {
                                                    "type": "string"
                                                },
                                                "version": {
                                                    "type": "integer"
                                                },
                                                "voided": {
                                                    "type": "boolean"
                                                },
                                                "deal": {
                                                    "type": "object",
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string"
                                                        },
                                                        "counterparty": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "reference": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "amount_minor": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ]
                                                        },
                                                        "currency": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "kind",
                                                        "counterparty",
                                                        "reference",
                                                        "amount_minor",
                                                        "currency"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "stage",
                                                "occurred_on",
                                                "version",
                                                "voided",
                                                "deal"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/vehicles/{uuid}/lifecycle/void": {
            "post": {
                "operationId": "vehicles.lifecycle.void",
                "description": "Cancels the last stage of one of your vehicles when it is a purchase or an in-service stage, with the version you read and a written reason. The stage stays in the log. A sale, a scrapping or a retirement cannot be cancelled here. Needs the Idempotency-Key header.\n\nRequires the key scope `fleet:lifecycle:write`.",
                "summary": "Cancel the last lifecycle stage",
                "tags": [
                    "LifecycleWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/VoidLifecycleStageRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "version": {
                                                "type": "integer",
                                                "description": "The version of the stage you read; a stale one is refused.",
                                                "examples": [
                                                    1
                                                ]
                                            },
                                            "reason": {
                                                "type": "string",
                                                "description": "Why, at least ten characters.",
                                                "examples": [
                                                    "Entered on the wrong vehicle"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "version",
                                            "reason"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The stage after it was cancelled.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "stage": "acquired",
                                                "occurred_on": "2026-01-15",
                                                "version": 2,
                                                "voided": true
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-14T12:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "stage": {
                                                            "type": "string"
                                                        },
                                                        "occurred_on": {
                                                            "type": "string"
                                                        },
                                                        "version": {
                                                            "type": "integer"
                                                        },
                                                        "voided": {
                                                            "type": "boolean"
                                                        },
                                                        "deal": {
                                                            "type": "object",
                                                            "properties": {
                                                                "kind": {
                                                                    "type": "string"
                                                                },
                                                                "counterparty": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ]
                                                                },
                                                                "reference": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ]
                                                                },
                                                                "amount_minor": {
                                                                    "type": [
                                                                        "integer",
                                                                        "null"
                                                                    ]
                                                                },
                                                                "currency": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "kind",
                                                                "counterparty",
                                                                "reference",
                                                                "amount_minor",
                                                                "currency"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "stage",
                                                        "occurred_on",
                                                        "version",
                                                        "voided",
                                                        "deal"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/fleet-assets/{uuid}/lifecycle/void": {
            "post": {
                "operationId": "fleet_assets.lifecycle.void",
                "description": "Cancels the last stage of one of your trailers or pieces of equipment when it is a purchase or an in-service stage, with the version you read and a written reason. The stage stays in the log. Needs the Idempotency-Key header.\n\nRequires the key scope `fleet:lifecycle:write`.",
                "summary": "Cancel the last fleet asset lifecycle stage",
                "tags": [
                    "LifecycleWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/VoidLifecycleStageRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "version": {
                                                "type": "integer",
                                                "description": "The version of the stage you read; a stale one is refused.",
                                                "examples": [
                                                    1
                                                ]
                                            },
                                            "reason": {
                                                "type": "string",
                                                "description": "Why, at least ten characters.",
                                                "examples": [
                                                    "Entered on the wrong asset"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "version",
                                            "reason"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The stage after it was cancelled.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "stage": "acquired",
                                                "occurred_on": "2026-01-15",
                                                "version": 2,
                                                "voided": true
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-14T12:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "stage": {
                                                            "type": "string"
                                                        },
                                                        "occurred_on": {
                                                            "type": "string"
                                                        },
                                                        "version": {
                                                            "type": "integer"
                                                        },
                                                        "voided": {
                                                            "type": "boolean"
                                                        },
                                                        "deal": {
                                                            "type": "object",
                                                            "properties": {
                                                                "kind": {
                                                                    "type": "string"
                                                                },
                                                                "counterparty": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ]
                                                                },
                                                                "reference": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ]
                                                                },
                                                                "amount_minor": {
                                                                    "type": [
                                                                        "integer",
                                                                        "null"
                                                                    ]
                                                                },
                                                                "currency": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "kind",
                                                                "counterparty",
                                                                "reference",
                                                                "amount_minor",
                                                                "currency"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "stage",
                                                        "occurred_on",
                                                        "version",
                                                        "voided",
                                                        "deal"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/live-links": {
            "get": {
                "operationId": "live_links.index",
                "description": "Lists your company's 24-hour live vehicle links, newest first, one page at a time: the link's uuid, the vehicle's uuid, when it was made and when it ends, and its state (live, ended or withdrawn). It never shows the link address, its token, a title or who opened it. A key limited to one branch sees none. Answers 404 while the live link feature is off.\n\nRequires the key scope `reporting:live_links:read`.",
                "summary": "List live vehicle links",
                "tags": [
                    "LiveLink"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of live links.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "0b6f6d0e-4a3e-4c52-9d51-8f0f6b3f4c11",
                                                    "vehicle_uuid": "7c1c1f3e-2e0a-4a6e-8a39-5f6f1d2b9a10",
                                                    "created_at": "2026-06-01T09:00:00Z",
                                                    "expires_at": "2026-06-02T09:00:00Z",
                                                    "state": "live"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "uuid": {
                                                                "type": "string"
                                                            },
                                                            "vehicle_uuid": {
                                                                "type": "string"
                                                            },
                                                            "created_at": {
                                                                "type": "string"
                                                            },
                                                            "expires_at": {
                                                                "type": "string"
                                                            },
                                                            "state": {
                                                                "type": "string"
                                                            }
                                                        },
                                                        "required": [
                                                            "uuid",
                                                            "vehicle_uuid",
                                                            "created_at",
                                                            "expires_at",
                                                            "state"
                                                        ]
                                                    }
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "page": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "limit": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": "integer"
                                                                                },
                                                                                []
                                                                            ]
                                                                        },
                                                                        "next_cursor": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": [
                                                                                        "string",
                                                                                        "null"
                                                                                    ]
                                                                                },
                                                                                []
                                                                            ]
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "limit",
                                                                        "next_cursor"
                                                                    ],
                                                                    "additionalProperties": []
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timezone": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "page",
                                                        "timezone"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/live-links/{uuid}/revoke": {
            "post": {
                "operationId": "live_links.revoke",
                "description": "Ends one of your company's live vehicle links at once; asking again for a link that is already withdrawn answers the same state and changes nothing. Send an Idempotency-Key header. A link of another company answers 404 exactly like one that does not exist. Answers 404 while the live link feature is off.\n\nRequires the key scope `reporting:live_links:revoke`.",
                "summary": "Withdraw a live vehicle link",
                "tags": [
                    "LiveLink"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The link with its state.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "0b6f6d0e-4a3e-4c52-9d51-8f0f6b3f4c11",
                                                "vehicle_uuid": "7c1c1f3e-2e0a-4a6e-8a39-5f6f1d2b9a10",
                                                "created_at": "2026-06-01T09:00:00Z",
                                                "expires_at": "2026-06-02T09:00:00Z",
                                                "state": "withdrawn"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "vehicle_uuid": {
                                                            "type": "string"
                                                        },
                                                        "created_at": {
                                                            "type": "string"
                                                        },
                                                        "expires_at": {
                                                            "type": "string"
                                                        },
                                                        "state": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "vehicle_uuid",
                                                        "created_at",
                                                        "expires_at",
                                                        "state"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "type": "string"
                                                        },
                                                        "timestamp": {
                                                            "type": "string"
                                                        },
                                                        "timezone": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "timezone"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/maintenance/costs": {
            "get": {
                "operationId": "maintenance.costs.index",
                "description": "Lists, for each of your vehicles with finished work orders in the period, the parts cost, the labour cost and their total in minor units of the currency, and the number of work orders; one line per vehicle and currency, never added across currencies. An order counts on the day it was finished; cancelled orders are left out. A key limited to a branch sees that branch's vehicles only. Never a driver, a workshop or an order text. The period is required and at most 366 days. Requires the key scope `fleet:maintenance_costs:read`, whose owner must still see maintenance costs on every call.\n\nRequires the key scope `fleet:maintenance_costs:read`.",
                "summary": "Read the maintenance costs of each vehicle",
                "tags": [
                    "MaintenanceCost"
                ],
                "parameters": [
                    {
                        "name": "from",
                        "in": "query",
                        "required": true,
                        "description": "Start of the period, ISO 8601 with an offset.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "required": true,
                        "description": "End of the period, after from and at most 366 days later.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "vehicle",
                        "in": "query",
                        "description": "Only this vehicle (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of vehicle cost lines.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                    "currency": "SAR",
                                                    "work_orders": 2,
                                                    "parts_cost_minor": 11050,
                                                    "labour_cost_minor": 2525,
                                                    "total_cost_minor": 13575
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/maintenance/plans": {
            "get": {
                "operationId": "maintenance.plans.index",
                "description": "Lists your company's maintenance plans, oldest first, one page at a time. Each carries the vehicle, its name (free text as typed), the schedule by distance and days, its type and status. A branch-limited key sees only the plans of the vehicles that are currently in its branch.\n\nRequires the key scope `maintenance:read`.",
                "summary": "List maintenance plans",
                "tags": [
                    "MaintenancePlan"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only plans in this state: active, paused or retired. Retired plans are left out unless you ask for them.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "active"
                    },
                    {
                        "name": "vehicle",
                        "in": "query",
                        "description": "Only the maintenance plans of this vehicle (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only maintenance plans changed at or after this moment (ISO 8601 with an offset, e.g. 2026-05-01T00:00:00Z).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of maintenance plans.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "2a7d9e41-5c63-4b18-9f20-8d1e4a6c3b99",
                                                    "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                    "name": {
                                                        "ar": "تغيير الزيت",
                                                        "en": "Oil change"
                                                    },
                                                    "plan_type": "preventive",
                                                    "category_code": "oil_change",
                                                    "every_km": 10000,
                                                    "every_days": 180,
                                                    "baseline_km": 120000,
                                                    "baseline_at": "2026-01-15T00:00:00Z",
                                                    "status": "active",
                                                    "created_at": "2026-01-15T08:00:00Z",
                                                    "updated_at": "2026-03-02T10:30:00Z",
                                                    "row_version": 3
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "post": {
                "operationId": "maintenance.plans.create",
                "description": "Creates a repeating maintenance plan on one of your company's vehicles, as the panel does: a name in Arabic (English optional), the plan type and the interval in kilometres, days or hours, optionally the due-soon margins, the day and reading the cycle starts from, and a category code. A plan cannot be created from a template with a key. At most 20 plans an hour for one vehicle. A vehicle of another company or branch answers 404 exactly like one that does not exist. Requires the key scope `fleet:plans:write` and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:plans:write`.",
                "summary": "Create a maintenance plan",
                "tags": [
                    "PlanWrite"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/CreatePlanRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "vehicle": {
                                                "type": "string",
                                                "format": "uuid",
                                                "description": "The vehicle, by its uuid.",
                                                "examples": [
                                                    "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11"
                                                ]
                                            },
                                            "name": {
                                                "type": "object",
                                                "description": "The plan name: ar is required, en is optional, each up to 100 characters.",
                                                "examples": [
                                                    {
                                                        "ar": "تغيير الزيت",
                                                        "en": "Oil change"
                                                    }
                                                ]
                                            },
                                            "every_km": {
                                                "type": "integer",
                                                "description": "Repeat every this many kilometres.",
                                                "examples": [
                                                    10000
                                                ]
                                            },
                                            "every_days": {
                                                "type": "integer",
                                                "description": "Repeat every this many days.",
                                                "examples": [
                                                    180
                                                ]
                                            }
                                        },
                                        "required": [
                                            "vehicle",
                                            "name"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The plan that was created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "2a7d9e41-5c63-4b18-9f20-8d1e4a6c3b99",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "name": {
                                                    "ar": "تغيير الزيت",
                                                    "en": "Oil change"
                                                },
                                                "plan_type": "preventive",
                                                "category_code": "oil_change",
                                                "every_km": 10000,
                                                "every_days": 180,
                                                "baseline_km": 120000,
                                                "baseline_at": "2026-01-15T00:00:00Z",
                                                "status": "active",
                                                "created_at": "2026-01-15T08:00:00Z",
                                                "updated_at": "2026-03-02T10:30:00Z",
                                                "row_version": 3
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uuid": {
                                                    "type": "string"
                                                },
                                                "vehicle_uuid": {
                                                    "type": "string"
                                                },
                                                "name": {
                                                    "type": "string"
                                                },
                                                "plan_type": {
                                                    "type": "string"
                                                },
                                                "category_code": {
                                                    "type": "string"
                                                },
                                                "every_km": {
                                                    "type": "string"
                                                },
                                                "every_days": {
                                                    "type": "string"
                                                },
                                                "baseline_km": {
                                                    "type": [
                                                        "number",
                                                        "null"
                                                    ]
                                                },
                                                "baseline_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "status": {
                                                    "type": "string"
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "row_version": {
                                                    "type": "integer"
                                                }
                                            },
                                            "required": [
                                                "uuid",
                                                "vehicle_uuid",
                                                "name",
                                                "plan_type",
                                                "category_code",
                                                "every_km",
                                                "every_days",
                                                "baseline_km",
                                                "baseline_at",
                                                "status",
                                                "created_at",
                                                "updated_at",
                                                "row_version"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/maintenance/plans/{uuid}": {
            "get": {
                "operationId": "maintenance.plans.show",
                "description": "Reads one of your company's maintenance plans by its uuid. A record of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `maintenance:read`.",
                "summary": "Read a maintenance plan",
                "tags": [
                    "MaintenancePlan"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The maintenance plan.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "2a7d9e41-5c63-4b18-9f20-8d1e4a6c3b99",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "name": {
                                                    "ar": "تغيير الزيت",
                                                    "en": "Oil change"
                                                },
                                                "plan_type": "preventive",
                                                "category_code": "oil_change",
                                                "every_km": 10000,
                                                "every_days": 180,
                                                "baseline_km": 120000,
                                                "baseline_at": "2026-01-15T00:00:00Z",
                                                "status": "active",
                                                "created_at": "2026-01-15T08:00:00Z",
                                                "updated_at": "2026-03-02T10:30:00Z",
                                                "row_version": 3
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "additionalProperties": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "patch": {
                "operationId": "maintenance.plans.update",
                "description": "Changes the terms of a plan that is not retired; what you leave out stays as it is. Send the `row_version` you read: a plan changed meanwhile or already retired answers 409. Requires the key scope `fleet:plans:write` and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:plans:write`.",
                "summary": "Change a maintenance plan",
                "tags": [
                    "PlanWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/UpdatePlanRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The version of the plan you read.",
                                                "examples": [
                                                    3
                                                ]
                                            },
                                            "every_km": {
                                                "type": "integer",
                                                "description": "Repeat every this many kilometres.",
                                                "examples": [
                                                    12000
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The plan after the change.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "2a7d9e41-5c63-4b18-9f20-8d1e4a6c3b99",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "name": {
                                                    "ar": "تغيير الزيت",
                                                    "en": "Oil change"
                                                },
                                                "plan_type": "preventive",
                                                "category_code": "oil_change",
                                                "every_km": 10000,
                                                "every_days": 180,
                                                "baseline_km": 120000,
                                                "baseline_at": "2026-01-15T00:00:00Z",
                                                "status": "active",
                                                "created_at": "2026-01-15T08:00:00Z",
                                                "updated_at": "2026-03-02T10:30:00Z",
                                                "row_version": 3
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "vehicle_uuid": {
                                                            "type": "string"
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        },
                                                        "plan_type": {
                                                            "type": "string"
                                                        },
                                                        "category_code": {
                                                            "type": "string"
                                                        },
                                                        "every_km": {
                                                            "type": "string"
                                                        },
                                                        "every_days": {
                                                            "type": "string"
                                                        },
                                                        "baseline_km": {
                                                            "type": [
                                                                "number",
                                                                "null"
                                                            ]
                                                        },
                                                        "baseline_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "row_version": {
                                                            "type": "integer"
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "vehicle_uuid",
                                                        "name",
                                                        "plan_type",
                                                        "category_code",
                                                        "every_km",
                                                        "every_days",
                                                        "baseline_km",
                                                        "baseline_at",
                                                        "status",
                                                        "created_at",
                                                        "updated_at",
                                                        "row_version"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/module-prices": {
            "get": {
                "operationId": "module_prices.index",
                "description": "Lists the module price table in force today, the same one the website shows: one price for each module, fleet band and cadence, in halalas before VAT. A draft, a proposal and a price that starts later are never listed. Requires the key scope `commercial:module_plans:read`.\n\nRequires the key scope `commercial:module_plans:read`.",
                "summary": "List module prices",
                "tags": [
                    "ModulePrice"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Every current price in one page; next_cursor is always null.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "module_code": "tracking",
                                                    "band": {
                                                        "code": "b1",
                                                        "min_vehicles": 1,
                                                        "max_vehicles": 10
                                                    },
                                                    "cadence": "month",
                                                    "unit": "per_vehicle",
                                                    "amount_minor": 1500,
                                                    "currency": "SAR",
                                                    "effective_from": "2026-09-01"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/module-subscriptions": {
            "get": {
                "operationId": "module_subscriptions.index",
                "description": "Lists your company's module subscriptions, one page at a time: the module, the fleet band, the quantity, the price frozen when it started, its state and its term. Ended subscriptions are left out unless you ask state=ended. Requires the key scope `commercial:module_plans:read` and an owner who may view subscriptions; nothing can be bought or changed over the API.\n\nRequires the key scope `commercial:module_plans:read`.",
                "summary": "List module subscriptions",
                "tags": [
                    "ModuleSubscription"
                ],
                "parameters": [
                    {
                        "name": "state",
                        "in": "query",
                        "description": "Only subscriptions in this state: active, cancel_at_term_end or ended; without it, every subscription that has not ended.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "active"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "One page of subscriptions; next_cursor is null on the last page.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "0198c3a2-7d41-7b0e-9a55-3f6e1c2d8b47",
                                                    "module_code": "tracking",
                                                    "cadence": "month",
                                                    "band": {
                                                        "code": "b1",
                                                        "min_vehicles": 1,
                                                        "max_vehicles": 10
                                                    },
                                                    "unit": "per_vehicle",
                                                    "quantity": 8,
                                                    "unit_amount_minor": 1500,
                                                    "currency": "SAR",
                                                    "state": "active",
                                                    "started_on": "2026-09-01",
                                                    "term_start": "2026-11-01",
                                                    "term_end": "2026-11-30",
                                                    "ended_on": null
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/module-subscriptions/{uuid}": {
            "get": {
                "operationId": "module_subscriptions.show",
                "description": "Reads one of your company's module subscriptions by its uuid. A subscription of another company and an unknown uuid both answer 404.\n\nRequires the key scope `commercial:module_plans:read`.",
                "summary": "Read a module subscription",
                "tags": [
                    "ModuleSubscription"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The subscription.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "0198c3a2-7d41-7b0e-9a55-3f6e1c2d8b47",
                                                "module_code": "tracking",
                                                "cadence": "month",
                                                "band": {
                                                    "code": "b1",
                                                    "min_vehicles": 1,
                                                    "max_vehicles": 10
                                                },
                                                "unit": "per_vehicle",
                                                "quantity": 8,
                                                "unit_amount_minor": 1500,
                                                "currency": "SAR",
                                                "state": "active",
                                                "started_on": "2026-09-01",
                                                "term_start": "2026-11-01",
                                                "term_end": "2026-11-30",
                                                "ended_on": null
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/reports/monthly-pnl": {
            "get": {
                "operationId": "reports.monthly_pnl",
                "description": "Lists, for each closed month the period touches (at most 24, never the month in progress), the revenue, the fuel, the expenses recorded by drivers, the total cost, the margin and its percent of the revenue. Money is a list of lines, one per currency, never added across currencies. A part the daily figures have not built for a month is null, never zero, and then that month has no margin. The revenue and what needs it are absent when the key's owner may not see the company's revenue.\n\nRequires the key scope `reporting:reports_monthly_pnl:read`.",
                "summary": "Read the monthly profit and loss report",
                "tags": [
                    "MonthlyProfitLossReport"
                ],
                "parameters": [
                    {
                        "name": "from",
                        "in": "query",
                        "required": true,
                        "description": "Start of the period, ISO 8601 with an offset.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "required": true,
                        "description": "End of the period, after from and at most 731 days later; its Saudi day is included.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The months, oldest first; meta.revenue_shown says whether the revenue is part of them.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "month": "2026-09",
                                                    "revenue": [
                                                        {
                                                            "currency": "SAR",
                                                            "amount": "210000.00"
                                                        }
                                                    ],
                                                    "unpriced_orders": 2,
                                                    "fuel": [
                                                        {
                                                            "currency": "SAR",
                                                            "amount": "52000.00"
                                                        }
                                                    ],
                                                    "expenses": [
                                                        {
                                                            "currency": "SAR",
                                                            "amount": "9000.00"
                                                        }
                                                    ],
                                                    "total_cost": [
                                                        {
                                                            "currency": "SAR",
                                                            "amount": "61000.00"
                                                        }
                                                    ],
                                                    "margin": [
                                                        {
                                                            "currency": "SAR",
                                                            "amount": "149000.00"
                                                        }
                                                    ],
                                                    "margin_percent": [
                                                        {
                                                            "currency": "SAR",
                                                            "percent": "71.0"
                                                        }
                                                    ]
                                                }
                                            ],
                                            "meta": {
                                                "revenue_shown": true
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": []
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "type": "string"
                                                        },
                                                        "timestamp": {
                                                            "type": "string"
                                                        },
                                                        "revenue_shown": {
                                                            "type": "boolean"
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "revenue_shown"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/vehicles/nearest": {
            "get": {
                "operationId": "vehicles.nearest",
                "description": "Lists up to 20 of your vehicles that the live map shows, nearest first in a straight line from a point you give in the X-Position header as \"latitude,longitude\" (kept out of the address on purpose): the vehicle uuid, name, plate, distance in kilometres, state (moving, idle, stopped or no_signal), speed and the time of its last fix. It shows no coordinates, no address and no driver. A key limited to one branch sees only that branch's vehicles.\n\nRequires the key scope `positions:read`.",
                "summary": "List the vehicles nearest to a point",
                "tags": [
                    "NearestVehicles"
                ],
                "parameters": [
                    {
                        "name": "lat",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "number",
                            "minimum": -90,
                            "maximum": 90
                        }
                    },
                    {
                        "name": "lng",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "number",
                            "minimum": -180,
                            "maximum": 180
                        }
                    },
                    {
                        "name": "signal_only",
                        "in": "query",
                        "schema": {
                            "type": [
                                "boolean",
                                "null"
                            ]
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The nearest vehicles.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "vehicle": "7c1c1f3e-2e0a-4a6e-8a39-5f6f1d2b9a10",
                                                    "name": "Truck 12",
                                                    "plate": "ABC 1234",
                                                    "distance_km": 3.4,
                                                    "state": "moving",
                                                    "speed_kmh": 62,
                                                    "fix_at": "2026-06-01T09:00:00+00:00"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/orders": {
            "get": {
                "operationId": "orders.index",
                "description": "Lists your company's transport orders, oldest first, one page at a time. A branch-limited key sees only its own branch. Staff notes are never returned. Free text (addresses, cancel_reason) is shown as your staff typed it. The pickup window is pickup_from and pickup_until. Times are UTC; meta.timezone names the platform time zone; money is in minor units of the order's currency.\n\nRequires the key scope `orders:read`.",
                "summary": "List orders",
                "tags": [
                    "Order"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only orders in this state: draft, confirmed, planned, in_transit, delivered, delivery_failed, delivered_partial, closed or cancelled.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "confirmed"
                    },
                    {
                        "name": "branch",
                        "in": "query",
                        "description": "Only orders of this branch (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only orders changed at or after this moment (ISO 8601 with an offset, e.g. 2026-05-01T00:00:00Z).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of orders.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "6a8d1f3c-2b94-4e7a-8c05-1d9e7f2b3a66",
                                                    "reference": "ORD-20260601-0042",
                                                    "status": "confirmed",
                                                    "status_correction": false,
                                                    "shipper_uuid": "2f7b9c14-6d38-4a5e-b1c0-8e4a3d7f9b77",
                                                    "shipper_name": {
                                                        "ar": "شركة المثال",
                                                        "en": "Example Co"
                                                    },
                                                    "service_type": "full_truckload",
                                                    "cargo_type": "general",
                                                    "cargo_weight_kg": "18000.000",
                                                    "cargo_volume_m3": null,
                                                    "quantity": null,
                                                    "quantity_unit": null,
                                                    "pickup_city": "Riyadh",
                                                    "pickup_address": "Second Industrial City",
                                                    "pickup_latitude": 24.6012,
                                                    "pickup_longitude": 46.8231,
                                                    "dropoff_city": "Dammam",
                                                    "dropoff_address": null,
                                                    "dropoff_latitude": null,
                                                    "dropoff_longitude": null,
                                                    "pickup_from": null,
                                                    "pickup_until": null,
                                                    "due_by": "2026-06-03T12:00:00Z",
                                                    "agreed_price_minor": 450000,
                                                    "currency": "SAR",
                                                    "cancel_reason": null,
                                                    "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                    "created_at": "2026-06-01T08:30:00Z",
                                                    "updated_at": "2026-06-01T09:12:00Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/orders/{uuid}": {
            "get": {
                "operationId": "orders.show",
                "description": "Reads one of your company's transport orders by its uuid. An order of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `orders:read`.",
                "summary": "Read an order",
                "tags": [
                    "Order"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The order.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "6a8d1f3c-2b94-4e7a-8c05-1d9e7f2b3a66",
                                                "reference": "ORD-20260601-0042",
                                                "status": "confirmed",
                                                "status_correction": false,
                                                "shipper_uuid": "2f7b9c14-6d38-4a5e-b1c0-8e4a3d7f9b77",
                                                "shipper_name": {
                                                    "ar": "شركة المثال",
                                                    "en": "Example Co"
                                                },
                                                "service_type": "full_truckload",
                                                "cargo_type": "general",
                                                "cargo_weight_kg": "18000.000",
                                                "cargo_volume_m3": null,
                                                "quantity": null,
                                                "quantity_unit": null,
                                                "pickup_city": "Riyadh",
                                                "pickup_address": "Second Industrial City",
                                                "pickup_latitude": 24.6012,
                                                "pickup_longitude": 46.8231,
                                                "dropoff_city": "Dammam",
                                                "dropoff_address": null,
                                                "dropoff_latitude": null,
                                                "dropoff_longitude": null,
                                                "pickup_from": null,
                                                "pickup_until": null,
                                                "due_by": "2026-06-03T12:00:00Z",
                                                "agreed_price_minor": 450000,
                                                "currency": "SAR",
                                                "cancel_reason": null,
                                                "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                "created_at": "2026-06-01T08:30:00Z",
                                                "updated_at": "2026-06-01T09:12:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "additionalProperties": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/maintenance/stock": {
            "get": {
                "operationId": "maintenance.stock.index",
                "description": "Lists, one page at a time, the quantity of each spare part in each of your warehouses with its reorder level; only the warehouses your key's owner may see. A part of another company answers 404. Never a cost.\n\nRequires the key scope `maintenance:read`.",
                "summary": "List what each warehouse holds",
                "tags": [
                    "PartStock"
                ],
                "parameters": [
                    {
                        "name": "part",
                        "in": "query",
                        "description": "Only this part (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "below_reorder",
                        "in": "query",
                        "description": "true: only the rows below their reorder level.",
                        "schema": {
                            "type": "boolean"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of stock rows.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "8a1c3e55-6b2d-4f90-a7c4-0d9e2b1f3a77",
                                                    "part_uuid": "3c5d8e12-4f6a-4b79-8a21-7d9e0f1b2c34",
                                                    "part_number": "OF-1234",
                                                    "warehouse": "Main store",
                                                    "quantity": "12.000",
                                                    "reorder_level": "4.000",
                                                    "is_below_reorder_level": false,
                                                    "row_version": 4,
                                                    "updated_at": "2026-05-12T11:30:00Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": []
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "page": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "limit": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": "integer"
                                                                                },
                                                                                []
                                                                            ]
                                                                        },
                                                                        "next_cursor": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": [
                                                                                        "string",
                                                                                        "null"
                                                                                    ]
                                                                                },
                                                                                []
                                                                            ]
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "limit",
                                                                        "next_cursor"
                                                                    ],
                                                                    "additionalProperties": []
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timezone": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "page",
                                                        "timezone"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/maintenance/spare-parts/{uuid}/movements": {
            "get": {
                "operationId": "maintenance.spare_parts.movements",
                "description": "Lists, oldest first and one page at a time, the movements of one of your spare parts: opening balance, receipts, issues, returns, adjustments and transfers, each with its signed quantity, the warehouse, the balance after and the work order it served. Only the warehouses your key's owner may see. A part of another company answers 404 exactly like one that does not exist. Never a cost, a reason or a person.\n\nRequires the key scope `maintenance:read`.",
                "summary": "List the movements of a spare part",
                "tags": [
                    "PartStock"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only movements of this kind: opening, receipt, issue, return, adjustment, transfer_out or transfer_in.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "issue"
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of movements.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "4d6e8f10-2a3b-4c5d-9e7f-8a1b2c3d4e55",
                                                    "kind": "issue",
                                                    "quantity": "-2.000",
                                                    "balance_after": "10.000",
                                                    "warehouse": "Main store",
                                                    "counterpart_warehouse": null,
                                                    "work_order_uuid": "6c3f8b24-1e79-4a50-b3d6-9a2e7f4c1d08",
                                                    "created_at": "2026-05-12T09:15:00Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": []
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "page": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "limit": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": "integer"
                                                                                },
                                                                                []
                                                                            ]
                                                                        },
                                                                        "next_cursor": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": [
                                                                                        "string",
                                                                                        "null"
                                                                                    ]
                                                                                },
                                                                                []
                                                                            ]
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "limit",
                                                                        "next_cursor"
                                                                    ],
                                                                    "additionalProperties": []
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timezone": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "page",
                                                        "timezone"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/wasl/registrations": {
            "get": {
                "operationId": "wasl.registrations",
                "description": "Answers, for up to 100 of your own device ids, the WASL registration state of the vehicle each device is mapped to on your account right now: registered, in_progress, waiting_on_facts, not_completed, held_elsewhere, not_registered or not_requested, with the stored vehicle eligibility and when either last changed. A device id your account does not map to a vehicle right now answers found false, whether or not it exists elsewhere. The token needs the source:read ability; tokens issued before it was added carry ingest only and must be issued again.",
                "summary": "Read WASL registration states",
                "tags": [
                    "PartnerRegistrationStatus"
                ],
                "parameters": [
                    {
                        "name": "device_ids[]",
                        "in": "query",
                        "required": true,
                        "description": "Your own device ids, 1 to 100, each up to 128 characters; repeat as device_ids[]=…",
                        "schema": {
                            "type": "array",
                            "items": []
                        },
                        "example": [
                            "dev-1001",
                            "dev-1002"
                        ]
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "One entry per distinct asked device id, in the order each was first asked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "registrations": [
                                                    {
                                                        "device_id": "dev-1001",
                                                        "found": true,
                                                        "state": "registered",
                                                        "eligibility": "eligible",
                                                        "updated_at": "2026-10-18T09:00:00Z"
                                                    },
                                                    {
                                                        "device_id": "dev-1002",
                                                        "found": false,
                                                        "state": null,
                                                        "eligibility": null,
                                                        "updated_at": null
                                                    }
                                                ]
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "7f3c9a1e-2b4d-4c8e-9f10-000000000000",
                                                "timestamp": "2026-10-18T09:00:01Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "registrations": {
                                                            "type": "array",
                                                            "items": []
                                                        }
                                                    },
                                                    "required": [
                                                        "registrations"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the source token is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string",
                                    "examples": [
                                        {
                                            "success": false,
                                            "data": null,
                                            "error": {
                                                "code": "unauthenticated",
                                                "message": "Authentication is required."
                                            },
                                            "meta": {
                                                "request_id": "7f3c9a1e-2b4d-4c8e-9f10-000000000000",
                                                "timestamp": "2026-10-18T09:00:01Z"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: device_ids is missing, holds more than 100 ids, or an id is not text of up to 128 characters.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string",
                                    "examples": [
                                        {
                                            "success": false,
                                            "data": null,
                                            "error": {
                                                "code": "validation_failed",
                                                "message": "The request contains invalid fields.",
                                                "details": [
                                                    {
                                                        "field": "device_ids",
                                                        "code": "out_of_range",
                                                        "message": "This value is out of range."
                                                    }
                                                ]
                                            },
                                            "meta": {
                                                "request_id": "7f3c9a1e-2b4d-4c8e-9f10-000000000000",
                                                "timestamp": "2026-10-18T09:00:01Z"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/per-diem-rate-proposals": {
            "get": {
                "operationId": "per_diem_rate_proposals.index",
                "description": "Lists your company's proposed daily driver allowance rates, newest first, with their state (proposed, approved, rejected or cancelled) and, once approved, the ref of the rate it became. No reason, decision note or person is returned.\n\nRequires the key scope `fleet:per_diem_rates:read`.",
                "summary": "List per diem rate proposals",
                "tags": [
                    "PerDiemRateProposals"
                ],
                "parameters": [
                    {
                        "name": "state",
                        "in": "query",
                        "description": "Only proposals in this state.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "proposed"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "One page of proposals.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "ref": "Pq9dQ0m1v8aB2cD4eF5gHw",
                                                    "state": "proposed",
                                                    "activity_code": null,
                                                    "effective_from": "2026-12-01",
                                                    "daily_amount": "60.00",
                                                    "currency": "SAR",
                                                    "rate_ref": null
                                                }
                                            ],
                                            "meta": {
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "string"
                                            }
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "post": {
                "operationId": "per_diem_rate_proposals.propose",
                "description": "Proposes a daily driver allowance rate, general or for one activity, as the panel would add it. The key's owner is the proposer, so a different person must approve it in the panel before it counts; nothing changes until then. The start day is today or later and after the latest rate of the activity. The amount is in minor units. Capped per key and per company in a day.\n\nRequires the key scope `fleet:per_diem_rates:propose`.",
                "summary": "Propose a per diem rate",
                "tags": [
                    "PerDiemRateProposals"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/ProposePerDiemRateRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "activity": {
                                                "type": "string",
                                                "description": "The activity code; leave out for the general rate.",
                                                "examples": [
                                                    "transport"
                                                ]
                                            },
                                            "effective_from": {
                                                "type": "string",
                                                "format": "date",
                                                "description": "The start day, Y-m-d, today or later and at most a year ahead.",
                                                "examples": [
                                                    "2026-12-01"
                                                ]
                                            },
                                            "amount_minor": {
                                                "type": "integer",
                                                "description": "The daily amount in the currency's minor unit, zero or more.",
                                                "examples": [
                                                    6000
                                                ]
                                            },
                                            "currency": {
                                                "type": "string",
                                                "description": "A three-letter code the company has enabled; the default when left out.",
                                                "examples": [
                                                    "SAR"
                                                ]
                                            },
                                            "reason": {
                                                "type": "string",
                                                "description": "Why, plain text without a card number.",
                                                "examples": [
                                                    "Annual review"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "effective_from",
                                            "amount_minor",
                                            "reason"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The proposal that was made.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "ref": "Pq9dQ0m1v8aB2cD4eF5gHw",
                                                "state": "proposed"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "ref": {
                                                    "type": "string"
                                                },
                                                "state": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "ref",
                                                "state"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/per-diem-rate-proposals/{ref}/cancel": {
            "post": {
                "operationId": "per_diem_rate_proposals.cancel",
                "description": "Cancels a proposal that is still waiting for a decision. A proposal that was approved, rejected or cancelled already answers 409: an approved proposal is already a rate, and rates are never changed here.\n\nRequires the key scope `fleet:per_diem_rates:cancel`.",
                "summary": "Cancel a per diem rate proposal",
                "tags": [
                    "PerDiemRateProposals"
                ],
                "parameters": [
                    {
                        "name": "ref",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The proposal after the cancellation.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "ref": "Pq9dQ0m1v8aB2cD4eF5gHw",
                                                "state": "cancelled"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "ref": {
                                                            "type": "string"
                                                        },
                                                        "state": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "ref",
                                                        "state"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/per-diem-rates": {
            "get": {
                "operationId": "per_diem_rates.index",
                "description": "Lists your company's daily driver allowance rates, oldest first: the activity (empty for the general rate), the day it starts, the daily amount and its currency. A rate runs from its start day until a newer one of the same activity starts. Rates are never changed here, and no driver or reason text is returned.\n\nRequires the key scope `fleet:per_diem_rates:read`.",
                "summary": "List per diem rates",
                "tags": [
                    "PerDiemRates"
                ],
                "parameters": [
                    {
                        "name": "activity",
                        "in": "query",
                        "description": "Only the rates of this activity code.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "transport"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "One page of rates.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "ref": "Xk3dQ0m1v8aB2cD4eF5gHw",
                                                    "activity_code": null,
                                                    "effective_from": "2026-01-01",
                                                    "daily_amount": "50.00",
                                                    "currency": "SAR"
                                                }
                                            ],
                                            "meta": {
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "string"
                                            }
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/branches": {
            "get": {
                "operationId": "branches.index",
                "description": "Lists the active branches of your company, the main one first, at most 200: the uuid, the name in Arabic and English and the address. Requires the key scope `fleet:places:read`.\n\nRequires the key scope `fleet:places:read`.",
                "summary": "List the branches",
                "tags": [
                    "Place"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The branches.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                    "name": {
                                                        "ar": "الفرع الرئيسي",
                                                        "en": "Main branch"
                                                    },
                                                    "address": "Riyadh, Industrial City"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "page": {
                                                    "limit": 200,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/facilities": {
            "get": {
                "operationId": "facilities.index",
                "description": "Lists the active workshops, warehouses and fuel stations of your company, at most 200: the uuid, the kind, the name in Arabic and English, whether the place is the company's own (internal) or an outside one (external), the branch it belongs to by uuid and the address. No contact person, phone, e-mail or position is returned. A work order may name a workshop from this list. Requires the key scope `fleet:places:read`.\n\nRequires the key scope `fleet:places:read`.",
                "summary": "List the places of the company",
                "tags": [
                    "Place"
                ],
                "parameters": [
                    {
                        "name": "kind",
                        "in": "query",
                        "description": "Only places of this kind: workshop, warehouse or fuel_station.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "workshop"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The places.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "8e1c2d3f-6a47-4b90-9d15-2f3a4b5c6d77",
                                                    "kind": "workshop",
                                                    "name": {
                                                        "ar": "ورشة الشرق",
                                                        "en": "East workshop"
                                                    },
                                                    "ownership": "internal",
                                                    "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                    "address": "Riyadh, Second Industrial City"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "page": {
                                                    "limit": 200,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/maintenance/plans/{uuid}/pause": {
            "post": {
                "operationId": "maintenance.plans.pause",
                "description": "Stops an active plan from raising due notices until it is resumed. Send the `row_version` you read; a plan that is already paused or retired answers 409. Requires the key scope `fleet:plans:write` and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:plans:write`.",
                "summary": "Pause a maintenance plan",
                "tags": [
                    "PlanWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/PlanStatusRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The version of the plan you read.",
                                                "examples": [
                                                    3
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The plan, now paused.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "2a7d9e41-5c63-4b18-9f20-8d1e4a6c3b99",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "name": {
                                                    "ar": "تغيير الزيت",
                                                    "en": "Oil change"
                                                },
                                                "plan_type": "preventive",
                                                "category_code": "oil_change",
                                                "every_km": 10000,
                                                "every_days": 180,
                                                "baseline_km": 120000,
                                                "baseline_at": "2026-01-15T00:00:00Z",
                                                "status": "active",
                                                "created_at": "2026-01-15T08:00:00Z",
                                                "updated_at": "2026-03-02T10:30:00Z",
                                                "row_version": 3
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "vehicle_uuid": {
                                                            "type": "string"
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        },
                                                        "plan_type": {
                                                            "type": "string"
                                                        },
                                                        "category_code": {
                                                            "type": "string"
                                                        },
                                                        "every_km": {
                                                            "type": "string"
                                                        },
                                                        "every_days": {
                                                            "type": "string"
                                                        },
                                                        "baseline_km": {
                                                            "type": [
                                                                "number",
                                                                "null"
                                                            ]
                                                        },
                                                        "baseline_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "row_version": {
                                                            "type": "integer"
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "vehicle_uuid",
                                                        "name",
                                                        "plan_type",
                                                        "category_code",
                                                        "every_km",
                                                        "every_days",
                                                        "baseline_km",
                                                        "baseline_at",
                                                        "status",
                                                        "created_at",
                                                        "updated_at",
                                                        "row_version"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/maintenance/plans/{uuid}/resume": {
            "post": {
                "operationId": "maintenance.plans.resume",
                "description": "Makes a paused plan active again. Send the `row_version` you read; a plan that is already active or retired answers 409. Requires the key scope `fleet:plans:write` and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:plans:write`.",
                "summary": "Resume a maintenance plan",
                "tags": [
                    "PlanWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/PlanStatusRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The version of the plan you read.",
                                                "examples": [
                                                    4
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The plan, now active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "2a7d9e41-5c63-4b18-9f20-8d1e4a6c3b99",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "name": {
                                                    "ar": "تغيير الزيت",
                                                    "en": "Oil change"
                                                },
                                                "plan_type": "preventive",
                                                "category_code": "oil_change",
                                                "every_km": 10000,
                                                "every_days": 180,
                                                "baseline_km": 120000,
                                                "baseline_at": "2026-01-15T00:00:00Z",
                                                "status": "active",
                                                "created_at": "2026-01-15T08:00:00Z",
                                                "updated_at": "2026-03-02T10:30:00Z",
                                                "row_version": 3
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "vehicle_uuid": {
                                                            "type": "string"
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        },
                                                        "plan_type": {
                                                            "type": "string"
                                                        },
                                                        "category_code": {
                                                            "type": "string"
                                                        },
                                                        "every_km": {
                                                            "type": "string"
                                                        },
                                                        "every_days": {
                                                            "type": "string"
                                                        },
                                                        "baseline_km": {
                                                            "type": [
                                                                "number",
                                                                "null"
                                                            ]
                                                        },
                                                        "baseline_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "row_version": {
                                                            "type": "integer"
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "vehicle_uuid",
                                                        "name",
                                                        "plan_type",
                                                        "category_code",
                                                        "every_km",
                                                        "every_days",
                                                        "baseline_km",
                                                        "baseline_at",
                                                        "status",
                                                        "created_at",
                                                        "updated_at",
                                                        "row_version"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/maintenance/plans/{uuid}/retire": {
            "post": {
                "operationId": "maintenance.plans.retire",
                "description": "Retires a plan for good: it is final and cannot be changed, paused or resumed afterwards. Send the `row_version` you read and `confirm` set to true. Requires the key scope `fleet:plans:write` and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:plans:write`.",
                "summary": "Retire a maintenance plan",
                "tags": [
                    "PlanWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/PlanStatusRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The version of the plan you read.",
                                                "examples": [
                                                    4
                                                ]
                                            },
                                            "confirm": {
                                                "type": "boolean",
                                                "description": "Must be true: retiring cannot be undone.",
                                                "examples": [
                                                    true
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version",
                                            "confirm"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The plan, now retired.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "2a7d9e41-5c63-4b18-9f20-8d1e4a6c3b99",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "name": {
                                                    "ar": "تغيير الزيت",
                                                    "en": "Oil change"
                                                },
                                                "plan_type": "preventive",
                                                "category_code": "oil_change",
                                                "every_km": 10000,
                                                "every_days": 180,
                                                "baseline_km": 120000,
                                                "baseline_at": "2026-01-15T00:00:00Z",
                                                "status": "active",
                                                "created_at": "2026-01-15T08:00:00Z",
                                                "updated_at": "2026-03-02T10:30:00Z",
                                                "row_version": 3
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "vehicle_uuid": {
                                                            "type": "string"
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        },
                                                        "plan_type": {
                                                            "type": "string"
                                                        },
                                                        "category_code": {
                                                            "type": "string"
                                                        },
                                                        "every_km": {
                                                            "type": "string"
                                                        },
                                                        "every_days": {
                                                            "type": "string"
                                                        },
                                                        "baseline_km": {
                                                            "type": [
                                                                "number",
                                                                "null"
                                                            ]
                                                        },
                                                        "baseline_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "row_version": {
                                                            "type": "integer"
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "vehicle_uuid",
                                                        "name",
                                                        "plan_type",
                                                        "category_code",
                                                        "every_km",
                                                        "every_days",
                                                        "baseline_km",
                                                        "baseline_at",
                                                        "status",
                                                        "created_at",
                                                        "updated_at",
                                                        "row_version"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/positions/latest": {
            "get": {
                "operationId": "positions.latest",
                "description": "Lists the latest accepted position and state (moving, idle, parked or offline) of each of your vehicles that has reported, ordered by vehicle, one page at a time. A branch-limited key sees only its own branch. Times are UTC; meta.timezone names the platform time zone.\n\nRequires the key scope `positions:read`.",
                "summary": "List latest positions",
                "tags": [
                    "Position"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of latest positions.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                    "state": "moving",
                                                    "observed_at": "2026-06-01T08:59:10Z",
                                                    "latitude": 24.7136,
                                                    "longitude": 46.6753,
                                                    "speed_kmh": 62,
                                                    "ignition": true,
                                                    "weight_kg": null,
                                                    "temperature_c": null,
                                                    "humidity_pct": null
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/vehicles/{uuid}/position": {
            "get": {
                "operationId": "positions.vehicle",
                "description": "Reads the latest accepted position and state of one vehicle by its uuid. A vehicle that has not reported yet, or one of another company or branch, answers 404.\n\nRequires the key scope `positions:read`.",
                "summary": "Read a vehicle's latest position",
                "tags": [
                    "Position"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The latest position.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "state": "moving",
                                                "observed_at": "2026-06-01T08:59:10Z",
                                                "latitude": 24.7136,
                                                "longitude": 46.6753,
                                                "speed_kmh": 62,
                                                "ignition": true,
                                                "weight_kg": null,
                                                "temperature_c": null,
                                                "humidity_pct": null
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "vehicle_uuid": {
                                                    "type": "string"
                                                },
                                                "state": {
                                                    "type": "string"
                                                },
                                                "observed_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "latitude": {
                                                    "type": [
                                                        "number",
                                                        "null"
                                                    ]
                                                },
                                                "longitude": {
                                                    "type": [
                                                        "number",
                                                        "null"
                                                    ]
                                                },
                                                "speed_kmh": {
                                                    "type": [
                                                        "number",
                                                        "null"
                                                    ]
                                                },
                                                "ignition": {
                                                    "type": "string"
                                                },
                                                "weight_kg": {
                                                    "type": [
                                                        "number",
                                                        "null"
                                                    ]
                                                },
                                                "temperature_c": {
                                                    "type": [
                                                        "number",
                                                        "null"
                                                    ]
                                                },
                                                "humidity_pct": {
                                                    "type": [
                                                        "number",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "vehicle_uuid",
                                                "state",
                                                "observed_at",
                                                "latitude",
                                                "longitude",
                                                "speed_kmh",
                                                "ignition",
                                                "weight_kg",
                                                "temperature_c",
                                                "humidity_pct"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/vehicles/{uuid}/positions": {
            "get": {
                "operationId": "positions.history",
                "description": "Lists the accepted positions of one vehicle between from (included) and to (excluded), oldest first, at most 7 days at a time and at most 1000 points per page. Follow meta.page.next_cursor for the rest of the window; at a page boundary one point may repeat, so identify points by observed_at. Times are UTC; meta.timezone names the platform time zone.\n\nRequires the key scope `positions:read`.",
                "summary": "List a vehicle's position history",
                "tags": [
                    "Position"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "from",
                        "in": "query",
                        "required": true,
                        "description": "Start of the window, ISO 8601 with an offset (e.g. 2026-06-01T00:00:00Z); included.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "required": true,
                        "description": "End of the window, after from and at most 7 days later; excluded.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Points per page, 1 to 1000.",
                        "schema": {
                            "type": "integer",
                            "default": 500
                        },
                        "example": 500
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of positions.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "observed_at": "2026-06-01T08:59:10Z",
                                                    "received_at": "2026-06-01T08:59:12Z",
                                                    "latitude": 24.7136,
                                                    "longitude": 46.6753,
                                                    "speed_kmh": 62,
                                                    "heading": 90,
                                                    "ignition": true,
                                                    "temperature_c": null,
                                                    "humidity_pct": null,
                                                    "weight_kg": null,
                                                    "fuel_level_pct": null,
                                                    "fuel_level_l": null
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 500,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: from or to is missing or not an ISO 8601 time with an offset, to is not after from or is more than 7 days later, or the limit or cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": false,
                                            "data": null,
                                            "error": {
                                                "code": "validation_failed",
                                                "message": "The request contains invalid fields.",
                                                "details": [
                                                    {
                                                        "field": "to",
                                                        "code": "out_of_range",
                                                        "message": "This value is out of range."
                                                    }
                                                ]
                                            },
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "description": "Errors overview."
                                        },
                                        "errors": {
                                            "type": "object",
                                            "description": "A detailed description of each field that failed validation.",
                                            "additionalProperties": {
                                                "type": "array",
                                                "items": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    },
                                    "required": [
                                        "message",
                                        "errors"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/vehicles/{uuid}/positions/export": {
            "get": {
                "operationId": "positions.export",
                "description": "Streams the positions of one of your vehicles between from (included) and to (excluded), ISO 8601 with an offset and at most 31 days apart, as csv, gpx or kml, oldest first and at most 10,000 points. It needs the key scope positions:export, which is never part of positions:read, and a written reason of 10 to 300 characters that is recorded with the key as a privileged read before any point is read (without a record, 503). Per day there is a cap per vehicle and a cap per company, and your live map administrators are told once a day for each vehicle. A vehicle of another company, or out of your scope, answers 404 exactly like one that does not exist; a plan without route history answers 403 plan_feature_required. A vehicle sold earlier shows nothing after its sale day.\n\nRequires the key scope `positions:export`.",
                "summary": "Download a vehicle's positions as a file",
                "tags": [
                    "PositionExport"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "format",
                        "in": "query",
                        "required": true,
                        "description": "The file format: csv, gpx or kml.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "gpx"
                    },
                    {
                        "name": "from",
                        "in": "query",
                        "required": true,
                        "description": "The start of the window, included (ISO 8601 with an offset).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "required": true,
                        "description": "The end of the window, excluded.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "reason",
                        "in": "query",
                        "required": true,
                        "description": "Why the track is needed, 10 to 300 characters; never a card number.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "Customer dispute about delivery 2041"
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The file, in the format asked.",
                        "content": {
                            "text/html": {
                                "schema": {
                                    "type": "string"
                                }
                            },
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            },
                            "text/csv": {
                                "schema": {
                                    "type": "string"
                                }
                            },
                            "application/gpx+xml": {
                                "schema": {
                                    "type": "string"
                                }
                            },
                            "application/vnd.google-earth.kml+xml": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        },
                        "headers": {
                            "Transfer-Encoding": {
                                "schema": {
                                    "type": "string",
                                    "enum": [
                                        "chunked"
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/roadside/cases/{uuid}/provider-candidates": {
            "get": {
                "operationId": "roadside.provider_candidates",
                "description": "Lists, nearest first, up to twenty bases of the provider network within 100 km of the case that offer what its symptom needs: the base, the provider's public name, its service codes, the distance in kilometres and whether it is open now; never a phone, a contact, an address or a coordinate. A case with no position, or a company whose plan does not read the network, answers an empty list. A case of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `assistance:provider_messages:read`.",
                "summary": "List the providers that may be asked for a roadside case",
                "tags": [
                    "ProviderMessageRead"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The bases that may be asked, possibly none.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "location_uuid": "1d7f3a98-4b2c-4e65-9a10-6f8c2b5d0e47",
                                                    "provider_name": "Al Amal Garage",
                                                    "location_name": "Riyadh",
                                                    "services": [
                                                        "truck_repair",
                                                        "engine"
                                                    ],
                                                    "distance_km": 18.3,
                                                    "open_now": true
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/roadside/cases/{uuid}/requests": {
            "get": {
                "operationId": "roadside.requests.index",
                "description": "Lists the requests for help the case sent to providers, oldest first: the state (asked, accepted, declined, withdrawn, expired), the minutes the provider gave, the expected arrival and the provider's public name; never a phone, a contact, a reason or terms. A request to a place that is not in the provider network carries no name. A case of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `assistance:provider_messages:read`.",
                "summary": "List the provider requests of a roadside case",
                "tags": [
                    "ProviderMessageRead"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The requests of the case, possibly none.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "6c2e9b14-5d3a-4f81-b7a0-1e8d4c9a2f55",
                                                    "case_uuid": "5b1d7a20-3c4e-4f6a-9d11-8e2a0c7b6f33",
                                                    "service": "help",
                                                    "status": "accepted",
                                                    "provider_name": "Al Amal Garage - Riyadh",
                                                    "eta_minutes": 45,
                                                    "expected_arrival_at": "2026-06-01T09:45:00Z",
                                                    "asked_at": "2026-06-01T09:00:00Z",
                                                    "decided_at": "2026-06-01T09:02:00Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "post": {
                "operationId": "roadside.requests.ask",
                "description": "Asks one base of the provider network for help on one of your company's roadside cases, with the panel's own rules: the base must be one that may be asked for the case now (see the candidates), at most the allowed number of requests wait at once, and the same base is not asked twice while it waits. The request is recorded and the case moves on as in the panel; the provider answers through the status link you send with the link call. Counts against the daily message cap of the company. A base that may not be asked answers 422, a rule that blocks it 409 with its name in `reason`, and a case of another company or branch 404.\n\nRequires the key scope `assistance:provider_messages:write`.",
                "summary": "Ask a provider for help on a roadside case",
                "tags": [
                    "ProviderMessageWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/AskProviderRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "location_uuid": {
                                                "type": "string",
                                                "description": "The base to ask, as the provider candidates of the case return it.",
                                                "examples": [
                                                    "1d7f3a98-4b2c-4e65-9a10-6f8c2b5d0e47"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "location_uuid"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "6c2e9b14-5d3a-4f81-b7a0-1e8d4c9a2f55",
                                                "case_uuid": "5b1d7a20-3c4e-4f6a-9d11-8e2a0c7b6f33",
                                                "service": "help",
                                                "status": "accepted",
                                                "provider_name": "Al Amal Garage - Riyadh",
                                                "eta_minutes": 45,
                                                "expected_arrival_at": "2026-06-01T09:45:00Z",
                                                "asked_at": "2026-06-01T09:00:00Z",
                                                "decided_at": "2026-06-01T09:02:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uuid": {
                                                    "type": "string"
                                                },
                                                "case_uuid": {
                                                    "type": "string"
                                                },
                                                "service": {
                                                    "type": "string"
                                                },
                                                "status": {
                                                    "type": "string"
                                                },
                                                "provider_name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "eta_minutes": {
                                                    "type": "string"
                                                },
                                                "expected_arrival_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "asked_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "decided_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "uuid",
                                                "case_uuid",
                                                "service",
                                                "status",
                                                "provider_name",
                                                "eta_minutes",
                                                "expected_arrival_at",
                                                "asked_at",
                                                "decided_at"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "anyOf": [
                                                {
                                                    "type": "object"
                                                },
                                                {
                                                    "$ref": "#/components/schemas/CaseRuleViolation"
                                                }
                                            ]
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/roadside/requests/{uuid}": {
            "get": {
                "operationId": "roadside.requests.show",
                "description": "Reads one request for help by its uuid: the state, the minutes the provider gave and the provider's public name. A request of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `assistance:provider_messages:read`.",
                "summary": "Read a provider request",
                "tags": [
                    "ProviderMessageRead"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "6c2e9b14-5d3a-4f81-b7a0-1e8d4c9a2f55",
                                                "case_uuid": "5b1d7a20-3c4e-4f6a-9d11-8e2a0c7b6f33",
                                                "service": "help",
                                                "status": "accepted",
                                                "provider_name": "Al Amal Garage - Riyadh",
                                                "eta_minutes": 45,
                                                "expected_arrival_at": "2026-06-01T09:45:00Z",
                                                "asked_at": "2026-06-01T09:00:00Z",
                                                "decided_at": "2026-06-01T09:02:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uuid": {
                                                    "type": "string"
                                                },
                                                "case_uuid": {
                                                    "type": "string"
                                                },
                                                "service": {
                                                    "type": "string"
                                                },
                                                "status": {
                                                    "type": "string"
                                                },
                                                "provider_name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "eta_minutes": {
                                                    "type": "string"
                                                },
                                                "expected_arrival_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "asked_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "decided_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "uuid",
                                                "case_uuid",
                                                "service",
                                                "status",
                                                "provider_name",
                                                "eta_minutes",
                                                "expected_arrival_at",
                                                "asked_at",
                                                "decided_at"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/roadside/requests/{uuid}/link": {
            "post": {
                "operationId": "roadside.requests.link",
                "description": "Mails the provider the link of its request, to the provider's own registered contact at that base and never to an address you give; the link opens the provider-facing view of the request with its expiry and nothing more of the case. A new link ends the one before. A base with no registered email answers 409 link_no_contact, a link sent in the last minutes 409 link_recent, a request already answered or ended 409 request_answered. Counts against the daily message cap of the company. A request of another company or branch answers 404.\n\nRequires the key scope `assistance:provider_messages:write`.",
                "summary": "Mail a provider the status link of a request",
                "tags": [
                    "ProviderMessageWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "6c2e9b14-5d3a-4f81-b7a0-1e8d4c9a2f55",
                                                "case_uuid": "5b1d7a20-3c4e-4f6a-9d11-8e2a0c7b6f33",
                                                "service": "help",
                                                "status": "accepted",
                                                "provider_name": "Al Amal Garage - Riyadh",
                                                "eta_minutes": 45,
                                                "expected_arrival_at": "2026-06-01T09:45:00Z",
                                                "asked_at": "2026-06-01T09:00:00Z",
                                                "decided_at": "2026-06-01T09:02:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "case_uuid": {
                                                            "type": "string"
                                                        },
                                                        "service": {
                                                            "type": "string"
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "provider_name": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "eta_minutes": {
                                                            "type": "string"
                                                        },
                                                        "expected_arrival_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "asked_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "decided_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "case_uuid",
                                                        "service",
                                                        "status",
                                                        "provider_name",
                                                        "eta_minutes",
                                                        "expected_arrival_at",
                                                        "asked_at",
                                                        "decided_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/roadside/requests/{uuid}/withdraw": {
            "post": {
                "operationId": "roadside.requests.withdraw",
                "description": "Takes back a request that is waiting or accepted, as the panel does; the provider is not mailed. It is not counted against the message cap. A request already ended answers 409. A request of another company or branch answers 404.\n\nRequires the key scope `assistance:provider_messages:write`.",
                "summary": "Withdraw a provider request",
                "tags": [
                    "ProviderMessageWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The request after the change.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "6c2e9b14-5d3a-4f81-b7a0-1e8d4c9a2f55",
                                                "case_uuid": "5b1d7a20-3c4e-4f6a-9d11-8e2a0c7b6f33",
                                                "service": "help",
                                                "status": "accepted",
                                                "provider_name": "Al Amal Garage - Riyadh",
                                                "eta_minutes": 45,
                                                "expected_arrival_at": "2026-06-01T09:45:00Z",
                                                "asked_at": "2026-06-01T09:00:00Z",
                                                "decided_at": "2026-06-01T09:02:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "case_uuid": {
                                                            "type": "string"
                                                        },
                                                        "service": {
                                                            "type": "string"
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "provider_name": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "eta_minutes": {
                                                            "type": "string"
                                                        },
                                                        "expected_arrival_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "asked_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "decided_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "case_uuid",
                                                        "service",
                                                        "status",
                                                        "provider_name",
                                                        "eta_minutes",
                                                        "expected_arrival_at",
                                                        "asked_at",
                                                        "decided_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/roadside/ratings": {
            "get": {
                "operationId": "roadside.ratings.index",
                "description": "Lists the ratings your company gave to the help on its roadside cases, oldest first, one page at a time: the case, the provider and the whole-number scores; never the comment or who rated, and never a rating still under review.\n\nRequires the key scope `assistance:case_ratings:read`.",
                "summary": "List roadside ratings",
                "tags": [
                    "Rating"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only ratings with this overall score, 1 to 5.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "5"
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only ratings given at or after this moment (ISO 8601 with an offset).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of ratings.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "3f6a8d12-0b5c-4e97-8c41-a2d7e9b03c66",
                                                    "case_uuid": "5b1d7a20-3c4e-4f6a-9d11-8e2a0c7b6f33",
                                                    "provider_uuid": "8a1c5e33-2d7f-4b90-a6e4-5c0b9f1d7a02",
                                                    "stars": 4,
                                                    "arrival": 5,
                                                    "quality": 4,
                                                    "price": 3,
                                                    "communication": 4,
                                                    "rated_at": "2026-06-02T10:15:00Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/roadside/ratings/{uuid}": {
            "get": {
                "operationId": "roadside.ratings.show",
                "description": "Reads one rating of your company's roadside cases by its uuid. A rating of another company, or one still under review, answers 404 exactly like one that does not exist.\n\nRequires the key scope `assistance:case_ratings:read`.",
                "summary": "Read a roadside rating",
                "tags": [
                    "Rating"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The rating.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "3f6a8d12-0b5c-4e97-8c41-a2d7e9b03c66",
                                                "case_uuid": "5b1d7a20-3c4e-4f6a-9d11-8e2a0c7b6f33",
                                                "provider_uuid": "8a1c5e33-2d7f-4b90-a6e4-5c0b9f1d7a02",
                                                "stars": 4,
                                                "arrival": 5,
                                                "quality": 4,
                                                "price": 3,
                                                "communication": 4,
                                                "rated_at": "2026-06-02T10:15:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "additionalProperties": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/roadside/cases/{uuid}/rating": {
            "post": {
                "operationId": "roadside.ratings.store",
                "description": "Rates the help given on one of your company's roadside cases once it is done: from 1 to 5 stars, with four optional aspects and a short comment. A case is rated once and a rating is never changed. A case that is not done answers 422; one that is already rated answers 422. A rating of two stars or less opens a review item for the platform staff. A case of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `assistance:case_ratings:write`.",
                "summary": "Rate the help of a roadside case",
                "tags": [
                    "RatingWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/RateCaseRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "stars": {
                                                "type": "integer",
                                                "description": "The overall score, 1 to 5.",
                                                "examples": [
                                                    4
                                                ]
                                            },
                                            "arrival": {
                                                "type": "integer",
                                                "description": "How fast the help arrived, 1 to 5.",
                                                "examples": [
                                                    5
                                                ]
                                            },
                                            "quality": {
                                                "type": "integer",
                                                "description": "The quality of the work, 1 to 5.",
                                                "examples": [
                                                    4
                                                ]
                                            },
                                            "price": {
                                                "type": "integer",
                                                "description": "The price against what was agreed, 1 to 5.",
                                                "examples": [
                                                    3
                                                ]
                                            },
                                            "communication": {
                                                "type": "integer",
                                                "description": "How well the provider kept you informed, 1 to 5.",
                                                "examples": [
                                                    4
                                                ]
                                            },
                                            "comment": {
                                                "type": "string",
                                                "description": "Plain text up to 500 characters; it is shown to the staff only and never returned by the read endpoints.",
                                                "examples": [
                                                    "Arrived within the hour"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "stars"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The rating.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "3f6a8d12-0b5c-4e97-8c41-a2d7e9b03c66",
                                                "case_uuid": "5b1d7a20-3c4e-4f6a-9d11-8e2a0c7b6f33",
                                                "provider_uuid": "8a1c5e33-2d7f-4b90-a6e4-5c0b9f1d7a02",
                                                "stars": 4,
                                                "arrival": 5,
                                                "quality": 4,
                                                "price": 3,
                                                "communication": 4,
                                                "rated_at": "2026-06-02T10:15:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uuid": {
                                                    "type": "string"
                                                },
                                                "case_uuid": {
                                                    "type": "string"
                                                },
                                                "provider_uuid": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "stars": {
                                                    "type": "string"
                                                },
                                                "arrival": {
                                                    "type": "string"
                                                },
                                                "quality": {
                                                    "type": "string"
                                                },
                                                "price": {
                                                    "type": "string"
                                                },
                                                "communication": {
                                                    "type": "string"
                                                },
                                                "rated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "uuid",
                                                "case_uuid",
                                                "provider_uuid",
                                                "stars",
                                                "arrival",
                                                "quality",
                                                "price",
                                                "communication",
                                                "rated_at"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/maintenance/reliability": {
            "get": {
                "operationId": "maintenance.reliability.index",
                "description": "Lists, for each of your vehicles with a breakdown repair in the period or a fault open now, the failures, the mean time between two failures, the mean time from the work order's opening and from its start to its finish, the faults open now and the age of the oldest. A mean is null while it rests on too few observations; the count it rests on is shown beside it. Most failures first. A key limited to a branch sees that branch's vehicles only. Never an amount of money, a driver, a workshop, a cause or an order text. The period is required and at most 366 days. When more than 20,000 repairs fall in the range, the read is cut and `meta.incomplete` is true.\n\nRequires the key scope `maintenance:read`.",
                "summary": "Read the reliability of each vehicle",
                "tags": [
                    "ReliabilityFigure"
                ],
                "parameters": [
                    {
                        "name": "from",
                        "in": "query",
                        "required": true,
                        "description": "Start of the period, ISO 8601 with an offset.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "required": true,
                        "description": "End of the period, after from and at most 366 days later.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of vehicles with their reliability figures.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                    "failures": 4,
                                                    "failure_gaps": 3,
                                                    "mean_seconds_between_failures": 2592000,
                                                    "repairs_timed": 4,
                                                    "mean_seconds_opened_to_finished": 172800,
                                                    "mean_seconds_started_to_finished": 86400,
                                                    "open_faults": 1,
                                                    "oldest_open_fault_seconds": 432000
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/maintenance/repeat-faults": {
            "get": {
                "operationId": "maintenance.repeat_faults.index",
                "description": "Lists, newest repeat first, each finished breakdown repair of the period that repeats an earlier repair of the same vehicle inside your company's own repeat window: the vehicle, what the two repairs share (category, a part or an inspection item; the category name only when it is the category), the two days, the days between them and the kilometres between when both repairs recorded an odometer reading. A key limited to a branch sees that branch's vehicles only. Never a workshop, a part, an item, a person or an order text. The period is required and at most 366 days. When more than 20,000 repairs fall in the range, the read is cut and `meta.incomplete` is true.\n\nRequires the key scope `maintenance:read`.",
                "summary": "Read the repeat faults",
                "tags": [
                    "RepeatFaultFigure"
                ],
                "parameters": [
                    {
                        "name": "from",
                        "in": "query",
                        "required": true,
                        "description": "Start of the period, ISO 8601 with an offset.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "required": true,
                        "description": "End of the period, after from and at most 366 days later.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of repeat faults.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                    "basis": "category",
                                                    "category": "Brakes",
                                                    "first_day": "2026-10-01",
                                                    "repeat_day": "2026-10-11",
                                                    "days_between": 10,
                                                    "km_between": 820
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/replay-shares": {
            "get": {
                "operationId": "replay_shares.index",
                "description": "Lists your company's route replay links, newest first, one page at a time: the link's uuid, the vehicle's uuid, the route period it shows (from, until), when it was made and when it ends, how many times it was opened, and its state (live, ended, used_up or withdrawn). It never shows the link address, its token, a title or who opened it. A key limited to one branch sees none. Answers 404 while route replay sharing is off.\n\nRequires the key scope `reporting:replay_shares:read`.",
                "summary": "List route replay links",
                "tags": [
                    "ReplayShare"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of route replay links.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "0b6f6d0e-4a3e-4c52-9d51-8f0f6b3f4c11",
                                                    "vehicle_uuid": "7c1c1f3e-2e0a-4a6e-8a39-5f6f1d2b9a10",
                                                    "created_at": "2026-06-01T09:00:00Z",
                                                    "expires_at": "2026-06-02T09:00:00Z",
                                                    "from": "2026-05-31T06:00:00Z",
                                                    "until": "2026-05-31T18:00:00Z",
                                                    "opens": 1,
                                                    "state": "live"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "uuid": {
                                                                "type": "string"
                                                            },
                                                            "vehicle_uuid": {
                                                                "type": "string"
                                                            },
                                                            "created_at": {
                                                                "type": "string"
                                                            },
                                                            "expires_at": {
                                                                "type": "string"
                                                            },
                                                            "from": {
                                                                "type": "string"
                                                            },
                                                            "until": {
                                                                "type": "string"
                                                            },
                                                            "opens": {
                                                                "type": "integer"
                                                            },
                                                            "state": {
                                                                "type": "string"
                                                            }
                                                        },
                                                        "required": [
                                                            "uuid",
                                                            "vehicle_uuid",
                                                            "created_at",
                                                            "expires_at",
                                                            "from",
                                                            "until",
                                                            "opens",
                                                            "state"
                                                        ]
                                                    }
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "page": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "limit": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": "integer"
                                                                                },
                                                                                []
                                                                            ]
                                                                        },
                                                                        "next_cursor": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": [
                                                                                        "string",
                                                                                        "null"
                                                                                    ]
                                                                                },
                                                                                []
                                                                            ]
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "limit",
                                                                        "next_cursor"
                                                                    ],
                                                                    "additionalProperties": []
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timezone": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "page",
                                                        "timezone"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/replay-shares/{uuid}/revoke": {
            "post": {
                "operationId": "replay_shares.revoke",
                "description": "Ends one of your company's route replay links at once; asking again for a link that is already withdrawn answers the same state and changes nothing. Send an Idempotency-Key header. A link of another company answers 404 exactly like one that does not exist. Answers 404 while route replay sharing is off.\n\nRequires the key scope `reporting:replay_shares:revoke`.",
                "summary": "Withdraw a route replay link",
                "tags": [
                    "ReplayShare"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The link with its state.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "0b6f6d0e-4a3e-4c52-9d51-8f0f6b3f4c11",
                                                "vehicle_uuid": "7c1c1f3e-2e0a-4a6e-8a39-5f6f1d2b9a10",
                                                "created_at": "2026-06-01T09:00:00Z",
                                                "expires_at": "2026-06-02T09:00:00Z",
                                                "from": "2026-05-31T06:00:00Z",
                                                "until": "2026-05-31T18:00:00Z",
                                                "opens": 1,
                                                "state": "withdrawn"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "vehicle_uuid": {
                                                            "type": "string"
                                                        },
                                                        "created_at": {
                                                            "type": "string"
                                                        },
                                                        "expires_at": {
                                                            "type": "string"
                                                        },
                                                        "from": {
                                                            "type": "string"
                                                        },
                                                        "until": {
                                                            "type": "string"
                                                        },
                                                        "opens": {
                                                            "type": "integer"
                                                        },
                                                        "state": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "vehicle_uuid",
                                                        "created_at",
                                                        "expires_at",
                                                        "from",
                                                        "until",
                                                        "opens",
                                                        "state"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "type": "string"
                                                        },
                                                        "timestamp": {
                                                            "type": "string"
                                                        },
                                                        "timezone": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "timezone"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/road-hazards": {
            "get": {
                "operationId": "road_hazards.index",
                "description": "Lists the road hazards that drivers have reported and that are still live, soonest to end first and then by place, up to 300: the kind, its Arabic label, the place at three decimals and the seconds left. It never shows who reported a hazard or from which company. truncated is true when more than 300 are live: the ones that end last are then left out, so ask for an area (min_lat, min_lng, max_lat, max_lng, no wider than 5 degrees each way) instead of reading the whole country. Answers 404 while the road hazards feature is off.\n\nRequires the key scope `hazards:read`.",
                "summary": "List live road hazards",
                "tags": [
                    "RoadHazard"
                ],
                "parameters": [
                    {
                        "name": "min_lat",
                        "in": "query",
                        "schema": {
                            "type": [
                                "number",
                                "null"
                            ],
                            "minimum": -90,
                            "maximum": 90
                        }
                    },
                    {
                        "name": "max_lat",
                        "in": "query",
                        "schema": {
                            "type": [
                                "number",
                                "null"
                            ],
                            "minimum": -90,
                            "maximum": 90
                        }
                    },
                    {
                        "name": "min_lng",
                        "in": "query",
                        "schema": {
                            "type": [
                                "number",
                                "null"
                            ],
                            "minimum": -180,
                            "maximum": 180
                        }
                    },
                    {
                        "name": "max_lng",
                        "in": "query",
                        "schema": {
                            "type": [
                                "number",
                                "null"
                            ],
                            "minimum": -180,
                            "maximum": 180
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The live road hazards.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "hazards": [
                                                    {
                                                        "type": "accident",
                                                        "label": "حادث",
                                                        "lat": 24.713,
                                                        "lng": 46.675,
                                                        "seconds_left": 5400
                                                    }
                                                ],
                                                "truncated": false
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "hazards": {
                                                            "type": "string"
                                                        },
                                                        "truncated": {
                                                            "type": "boolean"
                                                        }
                                                    },
                                                    "required": [
                                                        "hazards",
                                                        "truncated"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/sensors/ingest": {
            "post": {
                "operationId": "sensors.ingest",
                "description": "Stores readings from the level sensors on your waste containers. Each reading names its sensor by device_ref (the reference your sensor was registered under), its time by observed_at (ISO 8601 with a time zone) or observed_at_epoch_ms, and either fill_pct (0 to 100) or distance_mm (the distance from the sensor to the waste); battery_pct, temperature_c, tilt_deg, fire and signal_dbm are optional, and event_id makes a retry safe. The answer is 200 with how many readings were stored, how many were already stored, and the index and reason of every one that was not stored (unknown_device: no active sensor of yours has that reference; unusable_reading: the sensor profile cannot use what was sent; storage_error: the reading could not be stored, send it again). A reading is never stored for another company. An empty batch or one over 200 readings answers 422 batch_too_large; invalid fields answer 422 validation_failed with one detail per field; a plan without sensor readings answers 403 forbidden.",
                "summary": "Send waste container sensor readings",
                "tags": [
                    "SensorIngest"
                ],
                "parameters": [
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "readings": {
                                        "type": "array",
                                        "description": "One or more readings. Fields: device_ref, observed_at or observed_at_epoch_ms, fill_pct or distance_mm (one of them required), battery_pct, temperature_c, tilt_deg, fire, signal_dbm, event_id.",
                                        "examples": [
                                            [
                                                {
                                                    "device_ref": "sensor-0001",
                                                    "observed_at": "2026-11-10T08:00:00Z",
                                                    "distance_mm": 640,
                                                    "battery_pct": 87,
                                                    "event_id": "e-0001"
                                                }
                                            ]
                                        ],
                                        "items": []
                                    }
                                },
                                "required": [
                                    "readings"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The batch was processed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "received": 2,
                                                "accepted": 1,
                                                "duplicates": 0,
                                                "rejected": [
                                                    {
                                                        "index": 1,
                                                        "code": "unknown_device"
                                                    }
                                                ]
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "7f3c9a1e-2b4d-4c8e-9f10-000000000000",
                                                "timestamp": "2026-11-10T08:00:01Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "received": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "integer"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "received"
                                                    ],
                                                    "additionalProperties": []
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the source token is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string",
                                    "examples": [
                                        {
                                            "success": false,
                                            "data": null,
                                            "error": {
                                                "code": "unauthenticated",
                                                "message": "Authentication is required."
                                            },
                                            "meta": {
                                                "request_id": "7f3c9a1e-2b4d-4c8e-9f10-000000000000",
                                                "timestamp": "2026-11-10T08:00:01Z"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the token lacks the sensor ability or the plan has no sensor readings.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string",
                                    "examples": [
                                        {
                                            "success": false,
                                            "data": null,
                                            "error": {
                                                "code": "forbidden",
                                                "message": "You are not allowed to do this."
                                            },
                                            "meta": {
                                                "request_id": "7f3c9a1e-2b4d-4c8e-9f10-000000000000",
                                                "timestamp": "2026-11-10T08:00:01Z"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed (one detail per invalid field) or batch_too_large.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string",
                                    "examples": [
                                        {
                                            "success": false,
                                            "data": null,
                                            "error": {
                                                "code": "validation_failed",
                                                "message": "The request contains invalid fields.",
                                                "details": [
                                                    {
                                                        "field": "readings.0.fill_pct",
                                                        "code": "out_of_range",
                                                        "message": "This value is out of range."
                                                    }
                                                ]
                                            },
                                            "meta": {
                                                "request_id": "7f3c9a1e-2b4d-4c8e-9f10-000000000000",
                                                "timestamp": "2026-11-10T08:00:01Z"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/maintenance/spare-parts": {
            "get": {
                "operationId": "maintenance.spare_parts.index",
                "description": "Lists your company's spare parts, oldest first, one page at a time. Each carries its part number, name, category, unit and status, the minimum reorder level and the quantity on hand in all your warehouses; never a cost or a supplier. Discontinued parts are left out unless you ask for them.\n\nRequires the key scope `maintenance:read`.",
                "summary": "List spare parts",
                "tags": [
                    "SparePart"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only parts in this state: active or discontinued. Discontinued parts are left out unless you ask for them.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "active"
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only parts changed at or after this moment (ISO 8601 with an offset, e.g. 2026-05-01T00:00:00Z).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of spare parts.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "3c5d8e12-4f6a-4b79-8a21-7d9e0f1b2c34",
                                                    "part_number": "OF-1234",
                                                    "name": "Oil filter",
                                                    "category": "filter",
                                                    "unit_of_measure": "piece",
                                                    "status": "active",
                                                    "row_version": 3,
                                                    "min_reorder_level": "4.000",
                                                    "on_hand_quantity": "12.000",
                                                    "warehouses": 2,
                                                    "is_below_reorder_level": false,
                                                    "created_at": "2026-05-10T09:00:00Z",
                                                    "updated_at": "2026-05-12T11:30:00Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "post": {
                "operationId": "maintenance.spare_parts.create",
                "description": "Defines a spare part of your company, as the panel does: its number (unique in the company), name, category code, unit (piece, set, litre, kg or meter), minimum reorder level and currency. It has no stock until stock is received with the key scope `fleet:stock:manage`. At most 200 parts a day for one company. Requires the key scope `fleet:parts:write` and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:parts:write`.",
                "summary": "Create a spare part",
                "tags": [
                    "SparePartWrite"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/SparePartRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "part_number": {
                                                "type": "string",
                                                "description": "The part number, up to 100 characters.",
                                                "examples": [
                                                    "OF-1234"
                                                ]
                                            },
                                            "name": {
                                                "type": "string",
                                                "description": "The part name, up to 250 characters.",
                                                "examples": [
                                                    "Oil filter"
                                                ]
                                            },
                                            "currency": {
                                                "type": "string",
                                                "description": "The currency its stock is valued in, fixed at creation.",
                                                "examples": [
                                                    "SAR"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "part_number",
                                            "name",
                                            "currency"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The part that was created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "3c5d8e12-4f6a-4b79-8a21-7d9e0f1b2c34",
                                                "part_number": "OF-1234",
                                                "name": "Oil filter",
                                                "category": "filter",
                                                "unit_of_measure": "piece",
                                                "status": "active",
                                                "row_version": 3,
                                                "min_reorder_level": "4.000",
                                                "on_hand_quantity": "12.000",
                                                "warehouses": 2,
                                                "is_below_reorder_level": false,
                                                "created_at": "2026-05-10T09:00:00Z",
                                                "updated_at": "2026-05-12T11:30:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uuid": {
                                                    "type": "string"
                                                },
                                                "part_number": {
                                                    "type": "string"
                                                },
                                                "name": {
                                                    "type": "string"
                                                },
                                                "category": {
                                                    "type": "string"
                                                },
                                                "unit_of_measure": {
                                                    "type": "string"
                                                },
                                                "status": {
                                                    "type": "string"
                                                },
                                                "row_version": {
                                                    "type": "integer"
                                                },
                                                "min_reorder_level": {
                                                    "type": "string"
                                                },
                                                "on_hand_quantity": {
                                                    "type": "string"
                                                },
                                                "warehouses": {
                                                    "type": "string"
                                                },
                                                "is_below_reorder_level": {
                                                    "type": "boolean"
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "uuid",
                                                "part_number",
                                                "name",
                                                "category",
                                                "unit_of_measure",
                                                "status",
                                                "row_version",
                                                "min_reorder_level",
                                                "on_hand_quantity",
                                                "warehouses",
                                                "is_below_reorder_level",
                                                "created_at",
                                                "updated_at"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/maintenance/spare-parts/{uuid}": {
            "get": {
                "operationId": "maintenance.spare_parts.show",
                "description": "Reads one of your company's spare parts by its uuid, with the quantity on hand. A record of another company answers 404 exactly like one that does not exist.\n\nRequires the key scope `maintenance:read`.",
                "summary": "Read a spare part",
                "tags": [
                    "SparePart"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The spare part.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "3c5d8e12-4f6a-4b79-8a21-7d9e0f1b2c34",
                                                "part_number": "OF-1234",
                                                "name": "Oil filter",
                                                "category": "filter",
                                                "unit_of_measure": "piece",
                                                "status": "active",
                                                "row_version": 3,
                                                "min_reorder_level": "4.000",
                                                "on_hand_quantity": "12.000",
                                                "warehouses": 2,
                                                "is_below_reorder_level": false,
                                                "created_at": "2026-05-10T09:00:00Z",
                                                "updated_at": "2026-05-12T11:30:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "additionalProperties": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "patch": {
                "operationId": "maintenance.spare_parts.update",
                "description": "Changes what a spare part is: number, name, category, unit or minimum reorder level; what you leave out stays as it is. Never its currency or its stock. Send the `row_version` you read: a part changed meanwhile answers 409. Requires the key scope `fleet:parts:write` and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:parts:write`.",
                "summary": "Change a spare part",
                "tags": [
                    "SparePartWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/SparePartRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The version of the part you read.",
                                                "examples": [
                                                    3
                                                ]
                                            },
                                            "name": {
                                                "type": "string",
                                                "description": "The part name, up to 250 characters.",
                                                "examples": [
                                                    "Oil filter, large"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The part after the change.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "3c5d8e12-4f6a-4b79-8a21-7d9e0f1b2c34",
                                                "part_number": "OF-1234",
                                                "name": "Oil filter",
                                                "category": "filter",
                                                "unit_of_measure": "piece",
                                                "status": "active",
                                                "row_version": 3,
                                                "min_reorder_level": "4.000",
                                                "on_hand_quantity": "12.000",
                                                "warehouses": 2,
                                                "is_below_reorder_level": false,
                                                "created_at": "2026-05-10T09:00:00Z",
                                                "updated_at": "2026-05-12T11:30:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "part_number": {
                                                            "type": "string"
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        },
                                                        "category": {
                                                            "type": "string"
                                                        },
                                                        "unit_of_measure": {
                                                            "type": "string"
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "row_version": {
                                                            "type": "integer"
                                                        },
                                                        "min_reorder_level": {
                                                            "type": "string"
                                                        },
                                                        "on_hand_quantity": {
                                                            "type": "string"
                                                        },
                                                        "warehouses": {
                                                            "type": "string"
                                                        },
                                                        "is_below_reorder_level": {
                                                            "type": "boolean"
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "part_number",
                                                        "name",
                                                        "category",
                                                        "unit_of_measure",
                                                        "status",
                                                        "row_version",
                                                        "min_reorder_level",
                                                        "on_hand_quantity",
                                                        "warehouses",
                                                        "is_below_reorder_level",
                                                        "created_at",
                                                        "updated_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/maintenance/spare-parts/{uuid}/discontinue": {
            "post": {
                "operationId": "maintenance.spare_parts.discontinue",
                "description": "Stops new receipts and issues of a part; its stock can still be counted, moved and returned. Send the `row_version` you read; a part already discontinued answers 409. Requires the key scope `fleet:parts:write` and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:parts:write`.",
                "summary": "Discontinue a spare part",
                "tags": [
                    "SparePartWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/SparePartStatusRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The version of the part you read.",
                                                "examples": [
                                                    3
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The part, now discontinued.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "3c5d8e12-4f6a-4b79-8a21-7d9e0f1b2c34",
                                                "part_number": "OF-1234",
                                                "name": "Oil filter",
                                                "category": "filter",
                                                "unit_of_measure": "piece",
                                                "status": "active",
                                                "row_version": 3,
                                                "min_reorder_level": "4.000",
                                                "on_hand_quantity": "12.000",
                                                "warehouses": 2,
                                                "is_below_reorder_level": false,
                                                "created_at": "2026-05-10T09:00:00Z",
                                                "updated_at": "2026-05-12T11:30:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "part_number": {
                                                            "type": "string"
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        },
                                                        "category": {
                                                            "type": "string"
                                                        },
                                                        "unit_of_measure": {
                                                            "type": "string"
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "row_version": {
                                                            "type": "integer"
                                                        },
                                                        "min_reorder_level": {
                                                            "type": "string"
                                                        },
                                                        "on_hand_quantity": {
                                                            "type": "string"
                                                        },
                                                        "warehouses": {
                                                            "type": "string"
                                                        },
                                                        "is_below_reorder_level": {
                                                            "type": "boolean"
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "part_number",
                                                        "name",
                                                        "category",
                                                        "unit_of_measure",
                                                        "status",
                                                        "row_version",
                                                        "min_reorder_level",
                                                        "on_hand_quantity",
                                                        "warehouses",
                                                        "is_below_reorder_level",
                                                        "created_at",
                                                        "updated_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/maintenance/spare-parts/{uuid}/reactivate": {
            "post": {
                "operationId": "maintenance.spare_parts.reactivate",
                "description": "Makes a discontinued part active again. Send the `row_version` you read; a part already active answers 409. Requires the key scope `fleet:parts:write` and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:parts:write`.",
                "summary": "Bring a spare part back",
                "tags": [
                    "SparePartWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/SparePartStatusRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The version of the part you read.",
                                                "examples": [
                                                    4
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The part, now active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "3c5d8e12-4f6a-4b79-8a21-7d9e0f1b2c34",
                                                "part_number": "OF-1234",
                                                "name": "Oil filter",
                                                "category": "filter",
                                                "unit_of_measure": "piece",
                                                "status": "active",
                                                "row_version": 3,
                                                "min_reorder_level": "4.000",
                                                "on_hand_quantity": "12.000",
                                                "warehouses": 2,
                                                "is_below_reorder_level": false,
                                                "created_at": "2026-05-10T09:00:00Z",
                                                "updated_at": "2026-05-12T11:30:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "part_number": {
                                                            "type": "string"
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        },
                                                        "category": {
                                                            "type": "string"
                                                        },
                                                        "unit_of_measure": {
                                                            "type": "string"
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "row_version": {
                                                            "type": "integer"
                                                        },
                                                        "min_reorder_level": {
                                                            "type": "string"
                                                        },
                                                        "on_hand_quantity": {
                                                            "type": "string"
                                                        },
                                                        "warehouses": {
                                                            "type": "string"
                                                        },
                                                        "is_below_reorder_level": {
                                                            "type": "boolean"
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "part_number",
                                                        "name",
                                                        "category",
                                                        "unit_of_measure",
                                                        "status",
                                                        "row_version",
                                                        "min_reorder_level",
                                                        "on_hand_quantity",
                                                        "warehouses",
                                                        "is_below_reorder_level",
                                                        "created_at",
                                                        "updated_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/maintenance/spare-parts/{uuid}/stock/receive": {
            "post": {
                "operationId": "maintenance.spare_parts.stock.receive",
                "description": "Receives a quantity of one of your spare parts into one of your warehouses at a unit price, as the panel does: the stock goes up and the warehouse's average price moves with it. The unit price must be within the part's recent receipt prices (the company's factor, 5 times unless it set another), else 422 with reason cost_out_of_range. A discontinued part answers 409; a part or warehouse you cannot see answers 404. Requires the key scope `fleet:stock:manage` and an `Idempotency-Key` header. The answer shows quantities only, never a price.\n\nRequires the key scope `fleet:stock:manage`.",
                "summary": "Receive stock of a spare part",
                "tags": [
                    "StockManage"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/ReceiveStockRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "warehouse": {
                                                "type": "string",
                                                "format": "uuid",
                                                "description": "The warehouse, by its uuid.",
                                                "examples": [
                                                    "8a1c3e55-6b2d-4f90-a7c4-0d9e2b1f3a77"
                                                ]
                                            },
                                            "quantity": {
                                                "type": "string",
                                                "description": "The quantity, a decimal string with at most three places.",
                                                "examples": [
                                                    "10.000"
                                                ]
                                            },
                                            "unit_cost": {
                                                "type": "string",
                                                "description": "The unit price in the part's currency, a decimal string with at most four places.",
                                                "examples": [
                                                    "12.5000"
                                                ]
                                            },
                                            "reference": {
                                                "type": "string",
                                                "description": "The supplier invoice or delivery reference, up to 100 characters.",
                                                "examples": [
                                                    "INV-1042"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "warehouse",
                                            "quantity",
                                            "unit_cost"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The receipt that was recorded.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "4d6e8f10-2a3b-4c5d-9e7f-8a1b2c3d4e55",
                                                "kind": "issue",
                                                "quantity": "-2.000",
                                                "balance_after": "10.000",
                                                "warehouse": "Main store",
                                                "counterpart_warehouse": null,
                                                "work_order_uuid": "6c3f8b24-1e79-4a50-b3d6-9a2e7f4c1d08",
                                                "created_at": "2026-05-12T09:15:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uuid": {
                                                    "type": "string"
                                                },
                                                "kind": {
                                                    "type": "string"
                                                },
                                                "quantity": {
                                                    "type": "string"
                                                },
                                                "balance_after": {
                                                    "type": "string"
                                                },
                                                "warehouse": {
                                                    "type": "string"
                                                },
                                                "counterpart_warehouse": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "work_order_uuid": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "uuid",
                                                "kind",
                                                "quantity",
                                                "balance_after",
                                                "warehouse",
                                                "counterpart_warehouse",
                                                "work_order_uuid",
                                                "created_at"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/maintenance/spare-parts/{uuid}/stock/count": {
            "post": {
                "operationId": "maintenance.spare_parts.stock.count",
                "description": "Sets what a warehouse holds of one of your spare parts to what was counted, at the version the counter saw (the row_version of the stock read), with a reason of 5 to 500 characters, as the panel does. A count that changes the quantity by more than the company's share (20 percent unless it set another) of what the warehouse held, and any count of a warehouse that holds nothing, answers 422 with reason needs_review and is made in the panel. A stale version answers 409. Requires the key scope `fleet:stock:manage` and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:stock:manage`.",
                "summary": "Count the stock of a spare part in a warehouse",
                "tags": [
                    "StockManage"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/CountStockRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "warehouse": {
                                                "type": "string",
                                                "format": "uuid",
                                                "description": "The warehouse, by its uuid.",
                                                "examples": [
                                                    "8a1c3e55-6b2d-4f90-a7c4-0d9e2b1f3a77"
                                                ]
                                            },
                                            "counted": {
                                                "type": "string",
                                                "description": "What was counted, a decimal string with at most three places.",
                                                "examples": [
                                                    "11.000"
                                                ]
                                            },
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The version of the stock the counter saw.",
                                                "examples": [
                                                    4
                                                ]
                                            },
                                            "reason": {
                                                "type": "string",
                                                "description": "Why the count differs, 5 to 500 characters of plain text.",
                                                "examples": [
                                                    "Annual count"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "warehouse",
                                            "counted",
                                            "row_version",
                                            "reason"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The adjustment that was recorded.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "4d6e8f10-2a3b-4c5d-9e7f-8a1b2c3d4e55",
                                                "kind": "issue",
                                                "quantity": "-2.000",
                                                "balance_after": "10.000",
                                                "warehouse": "Main store",
                                                "counterpart_warehouse": null,
                                                "work_order_uuid": "6c3f8b24-1e79-4a50-b3d6-9a2e7f4c1d08",
                                                "created_at": "2026-05-12T09:15:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uuid": {
                                                    "type": "string"
                                                },
                                                "kind": {
                                                    "type": "string"
                                                },
                                                "quantity": {
                                                    "type": "string"
                                                },
                                                "balance_after": {
                                                    "type": "string"
                                                },
                                                "warehouse": {
                                                    "type": "string"
                                                },
                                                "counterpart_warehouse": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "work_order_uuid": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "uuid",
                                                "kind",
                                                "quantity",
                                                "balance_after",
                                                "warehouse",
                                                "counterpart_warehouse",
                                                "work_order_uuid",
                                                "created_at"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/maintenance/spare-parts/{uuid}/stock/transfer": {
            "post": {
                "operationId": "maintenance.spare_parts.stock.transfer",
                "description": "Moves a quantity of one of your spare parts from one of your warehouses to another at the source's average price, with a reason of 5 to 500 characters, as the panel does. More than the source holds answers 422; the same warehouse twice answers 422; a part or warehouse you cannot see answers 404. Requires the key scope `fleet:stock:manage` and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:stock:manage`.",
                "summary": "Move stock of a spare part between warehouses",
                "tags": [
                    "StockManage"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/TransferStockRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "from": {
                                                "type": "string",
                                                "format": "uuid",
                                                "description": "The source warehouse, by its uuid.",
                                                "examples": [
                                                    "8a1c3e55-6b2d-4f90-a7c4-0d9e2b1f3a77"
                                                ]
                                            },
                                            "to": {
                                                "type": "string",
                                                "format": "uuid",
                                                "description": "The destination warehouse, by its uuid.",
                                                "examples": [
                                                    "9b2d4f66-7c3e-4a01-b8d5-1e0f3c2a4b88"
                                                ]
                                            },
                                            "quantity": {
                                                "type": "string",
                                                "description": "The quantity, a decimal string with at most three places.",
                                                "examples": [
                                                    "3.000"
                                                ]
                                            },
                                            "reason": {
                                                "type": "string",
                                                "description": "Why it is moved, 5 to 500 characters of plain text.",
                                                "examples": [
                                                    "Rebalance branch stock"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "from",
                                            "to",
                                            "quantity",
                                            "reason"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The movement out of the source that was recorded.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "4d6e8f10-2a3b-4c5d-9e7f-8a1b2c3d4e55",
                                                "kind": "issue",
                                                "quantity": "-2.000",
                                                "balance_after": "10.000",
                                                "warehouse": "Main store",
                                                "counterpart_warehouse": null,
                                                "work_order_uuid": "6c3f8b24-1e79-4a50-b3d6-9a2e7f4c1d08",
                                                "created_at": "2026-05-12T09:15:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uuid": {
                                                    "type": "string"
                                                },
                                                "kind": {
                                                    "type": "string"
                                                },
                                                "quantity": {
                                                    "type": "string"
                                                },
                                                "balance_after": {
                                                    "type": "string"
                                                },
                                                "warehouse": {
                                                    "type": "string"
                                                },
                                                "counterpart_warehouse": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "work_order_uuid": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "uuid",
                                                "kind",
                                                "quantity",
                                                "balance_after",
                                                "warehouse",
                                                "counterpart_warehouse",
                                                "work_order_uuid",
                                                "created_at"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/maintenance/spare-parts/{uuid}/stock/reorder-level": {
            "patch": {
                "operationId": "maintenance.spare_parts.stock.reorder_level",
                "description": "Sets the quantity at or below which one warehouse's stock of one of your spare parts calls for an order, at the version the sender saw (the row_version of the stock read), as the panel does. A stale version answers 409; a part or warehouse you cannot see, or a warehouse that has no stock row of the part, answers 404. Requires the key scope `fleet:stock:manage` and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:stock:manage`.",
                "summary": "Set the reorder level of a spare part in a warehouse",
                "tags": [
                    "StockManage"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/ReorderLevelRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "warehouse": {
                                                "type": "string",
                                                "format": "uuid",
                                                "description": "The warehouse, by its uuid.",
                                                "examples": [
                                                    "8a1c3e55-6b2d-4f90-a7c4-0d9e2b1f3a77"
                                                ]
                                            },
                                            "reorder_level": {
                                                "type": "string",
                                                "description": "The level, a decimal string with at most three places.",
                                                "examples": [
                                                    "4.000"
                                                ]
                                            },
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The version of the stock the sender saw.",
                                                "examples": [
                                                    4
                                                ]
                                            }
                                        },
                                        "required": [
                                            "warehouse",
                                            "reorder_level",
                                            "row_version"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The stock after the change.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "8a1c3e55-6b2d-4f90-a7c4-0d9e2b1f3a77",
                                                "part_uuid": "3c5d8e12-4f6a-4b79-8a21-7d9e0f1b2c34",
                                                "part_number": "OF-1234",
                                                "warehouse": "Main store",
                                                "quantity": "12.000",
                                                "reorder_level": "4.000",
                                                "is_below_reorder_level": false,
                                                "row_version": 4,
                                                "updated_at": "2026-05-12T11:30:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "part_uuid": {
                                                            "type": "string"
                                                        },
                                                        "part_number": {
                                                            "type": "string"
                                                        },
                                                        "warehouse": {
                                                            "type": "string"
                                                        },
                                                        "quantity": {
                                                            "type": "string"
                                                        },
                                                        "reorder_level": {
                                                            "type": "string"
                                                        },
                                                        "is_below_reorder_level": {
                                                            "type": "boolean"
                                                        },
                                                        "row_version": {
                                                            "type": "integer"
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "part_uuid",
                                                        "part_number",
                                                        "warehouse",
                                                        "quantity",
                                                        "reorder_level",
                                                        "is_below_reorder_level",
                                                        "row_version",
                                                        "updated_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/maintenance/work-orders/{uuid}/parts/issue": {
            "post": {
                "operationId": "maintenance.work_orders.parts.issue",
                "description": "Issues a quantity of one of your spare parts from one of your warehouses to a work order that is open or in progress, as the panel does: the stock goes down and the order's parts cost follows at the warehouse's own average price, which you never send and are never shown. Send the part and the warehouse by uuid and the quantity as a decimal string with at most three places. A finished or cancelled order answers 409; stock that is not enough, or a part in another currency than the order, answers 422. A record you cannot see, another company's or a warehouse that is not yours answers 404. At most 30 issues an hour for one order. Requires the key scope `fleet:stock:write` and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:stock:write`.",
                "summary": "Issue a part to a work order",
                "tags": [
                    "StockWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/IssuePartRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "part": {
                                                "type": "string",
                                                "format": "uuid",
                                                "description": "The spare part, by its uuid.",
                                                "examples": [
                                                    "3c5d8e12-4f6a-4b79-8a21-7d9e0f1b2c34"
                                                ]
                                            },
                                            "warehouse": {
                                                "type": "string",
                                                "format": "uuid",
                                                "description": "The warehouse, by its uuid.",
                                                "examples": [
                                                    "8a1c3e55-6b2d-4f90-a7c4-0d9e2b1f3a77"
                                                ]
                                            },
                                            "quantity": {
                                                "type": "string",
                                                "description": "The quantity, a decimal string with at most three places.",
                                                "examples": [
                                                    "2.000"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "part",
                                            "warehouse",
                                            "quantity"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The part line that was issued.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "5e7f9a21-3b4c-4d68-9e0a-1f2b3c4d5e66",
                                                "work_order_uuid": "6c3f8b24-1e79-4a50-b3d6-9a2e7f4c1d08",
                                                "part_uuid": "3c5d8e12-4f6a-4b79-8a21-7d9e0f1b2c34",
                                                "part_number": "OF-1234",
                                                "kind": "issue",
                                                "quantity": "2.000",
                                                "created_at": "2026-05-12T09:15:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uuid": {
                                                    "type": "string"
                                                },
                                                "work_order_uuid": {
                                                    "type": "string"
                                                },
                                                "part_uuid": {
                                                    "type": "string"
                                                },
                                                "part_number": {
                                                    "type": "string"
                                                },
                                                "kind": {
                                                    "type": "string"
                                                },
                                                "quantity": {
                                                    "type": "string"
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "uuid",
                                                "work_order_uuid",
                                                "part_uuid",
                                                "part_number",
                                                "kind",
                                                "quantity",
                                                "created_at"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/maintenance/work-orders/{uuid}/parts/{line}/return": {
            "post": {
                "operationId": "maintenance.work_orders.parts.return",
                "description": "Returns a quantity of a part that was issued to a work order to the warehouse it came from, at the cost it left at, as the panel does. The line is the part line of the issue, by its uuid, and must belong to the work order in the path. You cannot return more than is still out on the line, and a finished or cancelled order answers 409. Send the quantity as a decimal string with at most three places and, if you like, a plain reason. A record you cannot see answers 404. Requires the key scope `fleet:stock:write` and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:stock:write`.",
                "summary": "Return a part from a work order",
                "tags": [
                    "StockWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "line",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/ReturnPartRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "quantity": {
                                                "type": "string",
                                                "description": "The quantity to return, a decimal string with at most three places.",
                                                "examples": [
                                                    "1.000"
                                                ]
                                            },
                                            "reason": {
                                                "type": "string",
                                                "description": "Why it is returned, up to 500 characters of plain text.",
                                                "examples": [
                                                    "Wrong filter"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "quantity"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The return line that was recorded.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "5e7f9a21-3b4c-4d68-9e0a-1f2b3c4d5e66",
                                                "work_order_uuid": "6c3f8b24-1e79-4a50-b3d6-9a2e7f4c1d08",
                                                "part_uuid": "3c5d8e12-4f6a-4b79-8a21-7d9e0f1b2c34",
                                                "part_number": "OF-1234",
                                                "kind": "issue",
                                                "quantity": "2.000",
                                                "created_at": "2026-05-12T09:15:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uuid": {
                                                    "type": "string"
                                                },
                                                "work_order_uuid": {
                                                    "type": "string"
                                                },
                                                "part_uuid": {
                                                    "type": "string"
                                                },
                                                "part_number": {
                                                    "type": "string"
                                                },
                                                "kind": {
                                                    "type": "string"
                                                },
                                                "quantity": {
                                                    "type": "string"
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "uuid",
                                                "work_order_uuid",
                                                "part_uuid",
                                                "part_number",
                                                "kind",
                                                "quantity",
                                                "created_at"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/maintenance/suppliers": {
            "get": {
                "operationId": "maintenance.suppliers.index",
                "description": "Lists your company's suppliers, oldest first, one page at a time. Each carries its name, kind, status and tax number. The contact person, phone, email and note are never shown. Archived suppliers are left out unless you ask for them.\n\nRequires the key scope `suppliers:read`.",
                "summary": "List suppliers",
                "tags": [
                    "Supplier"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only suppliers in this state: active or archived. Archived suppliers are left out unless you ask for them.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "archived"
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only suppliers changed at or after this moment (ISO 8601 with an offset, e.g. 2026-05-01T00:00:00Z).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of suppliers.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "7b2f4e90-1c3d-4a58-9e6b-0d8a5c7f1e24",
                                                    "name": "Modern Tyres Est.",
                                                    "kind": "tyres",
                                                    "status": "active",
                                                    "tax_number": "300000000000003",
                                                    "row_version": 2,
                                                    "archived_at": null,
                                                    "created_at": "2026-05-10T09:00:00Z",
                                                    "updated_at": "2026-05-12T11:30:00Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "post": {
                "operationId": "maintenance.suppliers.store",
                "description": "Adds a supplier to your company, as the suppliers page does: its name, kind and optionally its tax number. A contact person, phone, email or note is never accepted over a key. A name or tax number that an active supplier of your company already has answers 422. Requires the key scope `fleet:suppliers:write` and a plan with maintenance.\n\nRequires the key scope `fleet:suppliers:write`.",
                "summary": "Add a supplier",
                "tags": [
                    "SupplierWrite"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/SupplierInputRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "name": {
                                                "type": "string",
                                                "description": "The supplier's name, one line, at most 150 characters.",
                                                "examples": [
                                                    "Modern Tyres Est."
                                                ]
                                            },
                                            "kind": {
                                                "type": "string",
                                                "description": "parts, tyres, workshop or other.",
                                                "examples": [
                                                    "tyres"
                                                ]
                                            },
                                            "tax_number": {
                                                "type": "string",
                                                "description": "The 15-digit VAT number, starting and ending with 3.",
                                                "examples": [
                                                    "300000000000003"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "name",
                                            "kind"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The supplier.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "7b2f4e90-1c3d-4a58-9e6b-0d8a5c7f1e24",
                                                "name": "Modern Tyres Est.",
                                                "kind": "tyres",
                                                "status": "active",
                                                "tax_number": "300000000000003",
                                                "row_version": 2,
                                                "archived_at": null,
                                                "created_at": "2026-05-10T09:00:00Z",
                                                "updated_at": "2026-05-12T11:30:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uuid": {
                                                    "type": "string"
                                                },
                                                "name": {
                                                    "type": "string"
                                                },
                                                "kind": {
                                                    "type": "string"
                                                },
                                                "status": {
                                                    "type": "string"
                                                },
                                                "tax_number": {
                                                    "type": "string"
                                                },
                                                "row_version": {
                                                    "type": "integer"
                                                },
                                                "archived_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "uuid",
                                                "name",
                                                "kind",
                                                "status",
                                                "tax_number",
                                                "row_version",
                                                "archived_at",
                                                "created_at",
                                                "updated_at"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/maintenance/suppliers/{uuid}": {
            "get": {
                "operationId": "maintenance.suppliers.show",
                "description": "Reads one of your company's suppliers by its uuid. A record of another company answers 404 exactly like one that does not exist.\n\nRequires the key scope `suppliers:read`.",
                "summary": "Read a supplier",
                "tags": [
                    "Supplier"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The supplier.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "7b2f4e90-1c3d-4a58-9e6b-0d8a5c7f1e24",
                                                "name": "Modern Tyres Est.",
                                                "kind": "tyres",
                                                "status": "active",
                                                "tax_number": "300000000000003",
                                                "row_version": 2,
                                                "archived_at": null,
                                                "created_at": "2026-05-10T09:00:00Z",
                                                "updated_at": "2026-05-12T11:30:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "additionalProperties": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "patch": {
                "operationId": "maintenance.suppliers.update",
                "description": "Changes a supplier's name, kind or tax number. Send the `row_version` you read: a supplier changed meanwhile answers 409. Send `tax_number` to set or clear it, leave it out to keep it. The contact details are never touched. An archived supplier is not changed. Requires the key scope `fleet:suppliers:write`.\n\nRequires the key scope `fleet:suppliers:write`.",
                "summary": "Change a supplier",
                "tags": [
                    "SupplierWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/SupplierInputRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The version of the supplier you read.",
                                                "examples": [
                                                    2
                                                ]
                                            },
                                            "name": {
                                                "type": "string",
                                                "description": "The supplier's name.",
                                                "examples": [
                                                    "Modern Tyres Est."
                                                ]
                                            },
                                            "kind": {
                                                "type": "string",
                                                "description": "parts, tyres, workshop or other.",
                                                "examples": [
                                                    "tyres"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version",
                                            "name",
                                            "kind"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The supplier.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "7b2f4e90-1c3d-4a58-9e6b-0d8a5c7f1e24",
                                                "name": "Modern Tyres Est.",
                                                "kind": "tyres",
                                                "status": "active",
                                                "tax_number": "300000000000003",
                                                "row_version": 2,
                                                "archived_at": null,
                                                "created_at": "2026-05-10T09:00:00Z",
                                                "updated_at": "2026-05-12T11:30:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        },
                                                        "kind": {
                                                            "type": "string"
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "tax_number": {
                                                            "type": "string"
                                                        },
                                                        "row_version": {
                                                            "type": "integer"
                                                        },
                                                        "archived_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "name",
                                                        "kind",
                                                        "status",
                                                        "tax_number",
                                                        "row_version",
                                                        "archived_at",
                                                        "created_at",
                                                        "updated_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/maintenance/suppliers/{uuid}/archive": {
            "post": {
                "operationId": "maintenance.suppliers.archive",
                "description": "Archives a supplier, as the suppliers page does: it leaves the default list and keeps its data; it is never deleted. Send the `row_version` you read. Requires the key scope `fleet:suppliers:write`.\n\nRequires the key scope `fleet:suppliers:write`.",
                "summary": "Archive a supplier",
                "tags": [
                    "SupplierWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/SupplierVersionRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The version of the supplier you read.",
                                                "examples": [
                                                    2
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The archived supplier.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "7b2f4e90-1c3d-4a58-9e6b-0d8a5c7f1e24",
                                                "name": "Modern Tyres Est.",
                                                "kind": "tyres",
                                                "status": "active",
                                                "tax_number": "300000000000003",
                                                "row_version": 2,
                                                "archived_at": null,
                                                "created_at": "2026-05-10T09:00:00Z",
                                                "updated_at": "2026-05-12T11:30:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        },
                                                        "kind": {
                                                            "type": "string"
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "tax_number": {
                                                            "type": "string"
                                                        },
                                                        "row_version": {
                                                            "type": "integer"
                                                        },
                                                        "archived_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "name",
                                                        "kind",
                                                        "status",
                                                        "tax_number",
                                                        "row_version",
                                                        "archived_at",
                                                        "created_at",
                                                        "updated_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/maintenance/suppliers/{uuid}/restore": {
            "post": {
                "operationId": "maintenance.suppliers.restore",
                "description": "Brings an archived supplier back to the active list with its data. A name or tax number that an active supplier already has answers 422. Send the `row_version` you read. Requires the key scope `fleet:suppliers:write`.\n\nRequires the key scope `fleet:suppliers:write`.",
                "summary": "Bring a supplier back",
                "tags": [
                    "SupplierWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/SupplierVersionRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The version of the supplier you read.",
                                                "examples": [
                                                    3
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The restored supplier.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "7b2f4e90-1c3d-4a58-9e6b-0d8a5c7f1e24",
                                                "name": "Modern Tyres Est.",
                                                "kind": "tyres",
                                                "status": "active",
                                                "tax_number": "300000000000003",
                                                "row_version": 2,
                                                "archived_at": null,
                                                "created_at": "2026-05-10T09:00:00Z",
                                                "updated_at": "2026-05-12T11:30:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        },
                                                        "kind": {
                                                            "type": "string"
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "tax_number": {
                                                            "type": "string"
                                                        },
                                                        "row_version": {
                                                            "type": "integer"
                                                        },
                                                        "archived_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "name",
                                                        "kind",
                                                        "status",
                                                        "tax_number",
                                                        "row_version",
                                                        "archived_at",
                                                        "created_at",
                                                        "updated_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/roadside/swaps": {
            "get": {
                "operationId": "roadside.swaps.index",
                "description": "Lists the replacements of a broken tractor head on your company's roadside cases, oldest first, one page at a time: the state, the two vehicles and the times; never a driver, a note or a position.\n\nRequires the key scope `assistance:case_swaps:read`.",
                "summary": "List roadside head swaps",
                "tags": [
                    "Swap"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only swaps in this state: proposed, approved, head_dispatched, applying, applied, refused, withdrawn or cancelled.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "applied"
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only swaps changed at or after this moment (ISO 8601 with an offset).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of head swaps.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "2e8c1f70-9a4b-4d3e-b6c5-71a0f3d92b18",
                                                    "case_uuid": "5b1d7a20-3c4e-4f6a-9d11-8e2a0c7b6f33",
                                                    "status": "approved",
                                                    "driver_mode": "same_driver_moves",
                                                    "from_vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                    "to_vehicle_uuid": "9d4a2c11-7b6e-4f08-8a35-c1e7d0b25f64",
                                                    "requested_at": "2026-06-01T08:40:00Z",
                                                    "decided_at": null,
                                                    "applied_at": null,
                                                    "updated_at": "2026-06-01T08:40:00Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/roadside/swaps/{uuid}": {
            "get": {
                "operationId": "roadside.swaps.show",
                "description": "Reads one head swap of your company's roadside cases by its uuid. A swap of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `assistance:case_swaps:read`.",
                "summary": "Read a roadside head swap",
                "tags": [
                    "Swap"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The head swap.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "2e8c1f70-9a4b-4d3e-b6c5-71a0f3d92b18",
                                                "case_uuid": "5b1d7a20-3c4e-4f6a-9d11-8e2a0c7b6f33",
                                                "status": "approved",
                                                "driver_mode": "same_driver_moves",
                                                "from_vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "to_vehicle_uuid": "9d4a2c11-7b6e-4f08-8a35-c1e7d0b25f64",
                                                "requested_at": "2026-06-01T08:40:00Z",
                                                "decided_at": null,
                                                "applied_at": null,
                                                "updated_at": "2026-06-01T08:40:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "additionalProperties": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/roadside/swaps/{uuid}/approve": {
            "post": {
                "operationId": "roadside.swaps.approve",
                "description": "Approves a proposed head swap. The approver is always a different person from the proposer (403 when it is the same person or the session is impersonated), and a proposal that needed a confirmation of the lines marked unknown needs the approver's own `confirm_compatibility` (409 swap_confirm_needed otherwise). Approving moves nothing: the head is sent, coupled and applied in the panel. A swap that is not waiting answers 409 swap_state. A swap of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `assistance:case_swap_approvals:write`.",
                "summary": "Approve a roadside head swap",
                "tags": [
                    "SwapApproval"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/ApproveSwapRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "confirm_compatibility": {
                                                "type": "boolean",
                                                "description": "Your own confirmation that the lines marked unknown fit; false when left out.",
                                                "examples": [
                                                    false
                                                ]
                                            }
                                        }
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The swap after the change.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "2e8c1f70-9a4b-4d3e-b6c5-71a0f3d92b18",
                                                "case_uuid": "5b1d7a20-3c4e-4f6a-9d11-8e2a0c7b6f33",
                                                "status": "approved",
                                                "driver_mode": "same_driver_moves",
                                                "from_vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "to_vehicle_uuid": "9d4a2c11-7b6e-4f08-8a35-c1e7d0b25f64",
                                                "requested_at": "2026-06-01T08:40:00Z",
                                                "decided_at": null,
                                                "applied_at": null,
                                                "updated_at": "2026-06-01T08:40:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "case_uuid": {
                                                            "type": "string"
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "driver_mode": {
                                                            "type": "string"
                                                        },
                                                        "from_vehicle_uuid": {
                                                            "type": "string"
                                                        },
                                                        "to_vehicle_uuid": {
                                                            "type": "string"
                                                        },
                                                        "requested_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "decided_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "applied_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "case_uuid",
                                                        "status",
                                                        "driver_mode",
                                                        "from_vehicle_uuid",
                                                        "to_vehicle_uuid",
                                                        "requested_at",
                                                        "decided_at",
                                                        "applied_at",
                                                        "updated_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/roadside/swaps/{uuid}/refuse": {
            "post": {
                "operationId": "roadside.swaps.refuse",
                "description": "Refuses a proposed head swap with a reason; the reason goes on the case timeline and is never returned by the read endpoints. A swap that is not waiting answers 409 swap_state. A swap of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `assistance:case_swap_approvals:write`.",
                "summary": "Refuse a roadside head swap",
                "tags": [
                    "SwapApproval"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/RefuseSwapRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "note": {
                                                "type": "string",
                                                "description": "Why the swap is refused, plain text up to 500 characters, with no card number.",
                                                "examples": [
                                                    "The other tractor is needed for a trip tomorrow"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "note"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The swap after the change.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "2e8c1f70-9a4b-4d3e-b6c5-71a0f3d92b18",
                                                "case_uuid": "5b1d7a20-3c4e-4f6a-9d11-8e2a0c7b6f33",
                                                "status": "approved",
                                                "driver_mode": "same_driver_moves",
                                                "from_vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "to_vehicle_uuid": "9d4a2c11-7b6e-4f08-8a35-c1e7d0b25f64",
                                                "requested_at": "2026-06-01T08:40:00Z",
                                                "decided_at": null,
                                                "applied_at": null,
                                                "updated_at": "2026-06-01T08:40:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "case_uuid": {
                                                            "type": "string"
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "driver_mode": {
                                                            "type": "string"
                                                        },
                                                        "from_vehicle_uuid": {
                                                            "type": "string"
                                                        },
                                                        "to_vehicle_uuid": {
                                                            "type": "string"
                                                        },
                                                        "requested_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "decided_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "applied_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "case_uuid",
                                                        "status",
                                                        "driver_mode",
                                                        "from_vehicle_uuid",
                                                        "to_vehicle_uuid",
                                                        "requested_at",
                                                        "decided_at",
                                                        "applied_at",
                                                        "updated_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/roadside/cases/{uuid}/swap-candidates": {
            "get": {
                "operationId": "roadside.swaps.candidates",
                "description": "Lists, nearest and most ready first, up to ten tractors of your company that could replace the broken head of one roadside case: the vehicle, its plain label, the distance from the case in kilometres when known, a verdict (`ready`, `needs_confirmation` when a line is unknown, or `ruled_out`) and one outcome per check (`pass`, `fail`, `unknown`); never a driver, a trip reference or a position. A case whose vehicle is not a tractor pulling a trailer answers an empty list. The list is read fresh; propose a swap with the vehicle you choose. A case of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `assistance:case_swaps:read`.",
                "summary": "List the replacement heads of a roadside case",
                "tags": [
                    "SwapCandidate"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The candidates, possibly none.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "vehicle_uuid": "9d4a2c11-7b6e-4f08-8a35-c1e7d0b25f64",
                                                    "label": "ABC 1234",
                                                    "distance_km": 12.4,
                                                    "verdict": "ready",
                                                    "checks": [
                                                        {
                                                            "key": "availability",
                                                            "outcome": "pass"
                                                        },
                                                        {
                                                            "key": "busy",
                                                            "outcome": "pass"
                                                        },
                                                        {
                                                            "key": "coupling",
                                                            "outcome": "pass"
                                                        },
                                                        {
                                                            "key": "position",
                                                            "outcome": "pass"
                                                        },
                                                        {
                                                            "key": "driver",
                                                            "outcome": "pass"
                                                        },
                                                        {
                                                            "key": "wasl",
                                                            "outcome": "pass"
                                                        }
                                                    ]
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/roadside/cases/{uuid}/swaps": {
            "post": {
                "operationId": "roadside.swaps.propose",
                "description": "Proposes replacing the broken tractor head of one of your company's roadside cases with another tractor of the company, with the panel's own checks (the case is on a running trip with a trailer, the tractor fits and is free). A different person approves it in the panel or with an approval key; nothing moves until the new head is coupled. A rule that blocks it answers 409 with its name in `reason` (swap_no_trailer, swap_wasl_trip, swap_candidate, swap_ruled_out, swap_confirm_needed, swap_no_head_driver, swap_no_trip_driver, swap_pending). A tractor of another company or one that does not exist answers 404, and so does a case of another company or branch.\n\nRequires the key scope `assistance:case_swaps:write`.",
                "summary": "Propose a roadside head swap",
                "tags": [
                    "SwapWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/ProposeSwapRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "to_vehicle_uuid": {
                                                "type": "string",
                                                "description": "The replacement tractor, as the vehicles endpoint returns it.",
                                                "examples": [
                                                    "9d4a2c11-7b6e-4f08-8a35-c1e7d0b25f64"
                                                ]
                                            },
                                            "driver_mode": {
                                                "type": "string",
                                                "description": "Who drives the new head: same_driver_moves or new_head_driver.",
                                                "examples": [
                                                    "same_driver_moves"
                                                ]
                                            },
                                            "confirm_compatibility": {
                                                "type": "boolean",
                                                "description": "Your own confirmation that the lines marked unknown fit; false when left out.",
                                                "examples": [
                                                    false
                                                ]
                                            }
                                        },
                                        "required": [
                                            "to_vehicle_uuid",
                                            "driver_mode"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The proposed swap.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "2e8c1f70-9a4b-4d3e-b6c5-71a0f3d92b18",
                                                "case_uuid": "5b1d7a20-3c4e-4f6a-9d11-8e2a0c7b6f33",
                                                "status": "approved",
                                                "driver_mode": "same_driver_moves",
                                                "from_vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "to_vehicle_uuid": "9d4a2c11-7b6e-4f08-8a35-c1e7d0b25f64",
                                                "requested_at": "2026-06-01T08:40:00Z",
                                                "decided_at": null,
                                                "applied_at": null,
                                                "updated_at": "2026-06-01T08:40:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uuid": {
                                                    "type": "string"
                                                },
                                                "case_uuid": {
                                                    "type": "string"
                                                },
                                                "status": {
                                                    "type": "string"
                                                },
                                                "driver_mode": {
                                                    "type": "string"
                                                },
                                                "from_vehicle_uuid": {
                                                    "type": "string"
                                                },
                                                "to_vehicle_uuid": {
                                                    "type": "string"
                                                },
                                                "requested_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "decided_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "applied_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "uuid",
                                                "case_uuid",
                                                "status",
                                                "driver_mode",
                                                "from_vehicle_uuid",
                                                "to_vehicle_uuid",
                                                "requested_at",
                                                "decided_at",
                                                "applied_at",
                                                "updated_at"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "anyOf": [
                                                {
                                                    "type": "object"
                                                },
                                                {
                                                    "$ref": "#/components/schemas/CaseRuleViolation"
                                                }
                                            ]
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/roadside/swaps/{uuid}/withdraw": {
            "post": {
                "operationId": "roadside.swaps.withdraw",
                "description": "Takes back a head swap that the same person proposed and nobody has decided yet. A swap already decided answers 409 swap_state; one proposed by someone else answers 403. A swap of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `assistance:case_swaps:write`.",
                "summary": "Withdraw a roadside head swap proposal",
                "tags": [
                    "SwapWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The swap after the change.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "2e8c1f70-9a4b-4d3e-b6c5-71a0f3d92b18",
                                                "case_uuid": "5b1d7a20-3c4e-4f6a-9d11-8e2a0c7b6f33",
                                                "status": "approved",
                                                "driver_mode": "same_driver_moves",
                                                "from_vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "to_vehicle_uuid": "9d4a2c11-7b6e-4f08-8a35-c1e7d0b25f64",
                                                "requested_at": "2026-06-01T08:40:00Z",
                                                "decided_at": null,
                                                "applied_at": null,
                                                "updated_at": "2026-06-01T08:40:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "case_uuid": {
                                                            "type": "string"
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "driver_mode": {
                                                            "type": "string"
                                                        },
                                                        "from_vehicle_uuid": {
                                                            "type": "string"
                                                        },
                                                        "to_vehicle_uuid": {
                                                            "type": "string"
                                                        },
                                                        "requested_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "decided_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "applied_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "case_uuid",
                                                        "status",
                                                        "driver_mode",
                                                        "from_vehicle_uuid",
                                                        "to_vehicle_uuid",
                                                        "requested_at",
                                                        "decided_at",
                                                        "applied_at",
                                                        "updated_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "anyOf": [
                                                {
                                                    "type": "object"
                                                },
                                                {
                                                    "$ref": "#/components/schemas/CaseRuleViolation"
                                                }
                                            ]
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/tracking-proposals": {
            "get": {
                "operationId": "tracking_proposals.index",
                "description": "Lists the device links your tracking platforms propose, oldest first, one page at a time. Pending ones by default; ask status=applied, rejected, superseded or failed for the rest. Only your own linked platforms appear. The reported values, device names and credentials are never returned; a proposal changes nothing until a person decides it in the panel. Needs the same right as the proposals page; closed (403) until your company's identity check is approved.\n\nRequires the key scope `tracking_proposals:read`.",
                "summary": "List tracking platform proposals",
                "tags": [
                    "TrackingProposal"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only proposals in this state (default pending).",
                        "schema": {
                            "type": "string"
                        },
                        "example": "pending"
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only proposals created at or after this moment (ISO 8601 with an offset).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of proposals.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "6c1d7a52-0e3b-4b9a-8f61-2d5e9a7b3c10",
                                                    "kind": "link",
                                                    "state": "pending",
                                                    "match_rule": "imei_exact",
                                                    "match_confidence": 100,
                                                    "is_conflict": false,
                                                    "needs_completion": [],
                                                    "waiting_for": null,
                                                    "failure_reason": null,
                                                    "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                    "created_at": "2026-11-14T08:30:00Z",
                                                    "decided_at": null
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-14T12:00:00Z",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/tracking-proposals/{uuid}": {
            "get": {
                "operationId": "tracking_proposals.show",
                "description": "Reads one proposal of your own linked platforms by its uuid. Another company's proposal answers 404 exactly like one that does not exist.\n\nRequires the key scope `tracking_proposals:read`.",
                "summary": "Read a tracking platform proposal",
                "tags": [
                    "TrackingProposal"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The proposal.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "6c1d7a52-0e3b-4b9a-8f61-2d5e9a7b3c10",
                                                "kind": "link",
                                                "state": "pending",
                                                "match_rule": "imei_exact",
                                                "match_confidence": 100,
                                                "is_conflict": false,
                                                "needs_completion": [],
                                                "waiting_for": null,
                                                "failure_reason": null,
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "created_at": "2026-11-14T08:30:00Z",
                                                "decided_at": null
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-14T12:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "additionalProperties": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/trips": {
            "get": {
                "operationId": "trips.index",
                "description": "Lists your company's trips, oldest first, one page at a time; each carries its vehicle, driver and orders by uuid. A branch-limited key sees only its own branch. Staff notes are never returned; cancel_reason is free text shown as your staff typed it. Times are UTC; meta.timezone names the platform time zone.\n\nRequires the key scope `trips:read`.",
                "summary": "List trips",
                "tags": [
                    "Trip"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only trips in this state: planned, assigned, loading, en_route, delivered, closed or cancelled.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "en_route"
                    },
                    {
                        "name": "branch",
                        "in": "query",
                        "description": "Only trips of this branch (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only trips changed at or after this moment (ISO 8601 with an offset, e.g. 2026-05-01T00:00:00Z).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of trips.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "8b3e5a70-4c19-4d2f-9a6e-7f1c0d2b4e88",
                                                    "reference": "TRP-20260601-0007",
                                                    "status": "en_route",
                                                    "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                    "driver_uuid": "3c1e9a52-8d47-4b6a-a2f0-5e7d9b4c1a44",
                                                    "order_uuids": [
                                                        "6a8d1f3c-2b94-4e7a-8c05-1d9e7f2b3a66"
                                                    ],
                                                    "planned_from": "2026-06-01T05:00:00Z",
                                                    "planned_until": "2026-06-01T17:00:00Z",
                                                    "dispatched_at": "2026-06-01T04:40:00Z",
                                                    "loading_at": "2026-06-01T05:10:00Z",
                                                    "started_at": "2026-06-01T06:00:00Z",
                                                    "delivered_at": null,
                                                    "closed_at": null,
                                                    "cancelled_at": null,
                                                    "cancel_reason": null,
                                                    "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                    "created_at": "2026-06-01T04:00:00Z",
                                                    "updated_at": "2026-06-01T06:00:00Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/trips/{uuid}": {
            "get": {
                "operationId": "trips.show",
                "description": "Reads one of your company's trips by its uuid. A trip of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `trips:read`.",
                "summary": "Read a trip",
                "tags": [
                    "Trip"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The trip.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "8b3e5a70-4c19-4d2f-9a6e-7f1c0d2b4e88",
                                                "reference": "TRP-20260601-0007",
                                                "status": "en_route",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "driver_uuid": "3c1e9a52-8d47-4b6a-a2f0-5e7d9b4c1a44",
                                                "order_uuids": [
                                                    "6a8d1f3c-2b94-4e7a-8c05-1d9e7f2b3a66"
                                                ],
                                                "planned_from": "2026-06-01T05:00:00Z",
                                                "planned_until": "2026-06-01T17:00:00Z",
                                                "dispatched_at": "2026-06-01T04:40:00Z",
                                                "loading_at": "2026-06-01T05:10:00Z",
                                                "started_at": "2026-06-01T06:00:00Z",
                                                "delivered_at": null,
                                                "closed_at": null,
                                                "cancelled_at": null,
                                                "cancel_reason": null,
                                                "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                "created_at": "2026-06-01T04:00:00Z",
                                                "updated_at": "2026-06-01T06:00:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "additionalProperties": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/trips/{uuid}/delay-excuse": {
            "post": {
                "operationId": "trips.delay_excuse.store",
                "description": "Excuses the delay of one of your company's trips in writing, as a manager does in the panel: the excuse needs a roadside case of your company opened no later than the delay ended, the setting that allows excuses, and the key's owner may not excuse a trip they made or dispatched unless they are a company administrator. One open excuse per trip; at most 5 attempts in 10 minutes per trip.\n\nRequires the key scope `logistics:trip_delay_excuses:write`.",
                "summary": "Excuse the delay of a trip",
                "tags": [
                    "TripDelayExcuse"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/TripDelayExcuseRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "reason": {
                                                "type": "string",
                                                "description": "The written reason, 20 to 500 characters of real words. It is kept in the record and never returned.",
                                                "examples": [
                                                    "The engine failed on the road and the truck waited two hours for a tow."
                                                ]
                                            }
                                        },
                                        "required": [
                                            "reason"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The excuse: its id and state only.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "state": "active"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-14T20:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uuid": {
                                                    "type": "string"
                                                },
                                                "state": {
                                                    "type": "string",
                                                    "enum": [
                                                        "active",
                                                        "revoked"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "uuid",
                                                "state"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/trips/{uuid}/delay-excuse/revoke": {
            "post": {
                "operationId": "trips.delay_excuse.revoke",
                "description": "Revokes the open excuse of one of your company's trips in writing; the excuse stays as history and is never deleted. At most 5 attempts in 10 minutes per trip.\n\nRequires the key scope `logistics:trip_delay_excuses:write`.",
                "summary": "Revoke the delay excuse of a trip",
                "tags": [
                    "TripDelayExcuse"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/TripDelayExcuseRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "reason": {
                                                "type": "string",
                                                "description": "Why the excuse is withdrawn, 20 to 500 characters of real words. It is kept in the record and never returned.",
                                                "examples": [
                                                    "The excuse was entered on the wrong trip by mistake."
                                                ]
                                            }
                                        },
                                        "required": [
                                            "reason"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The excuse: its id and state only.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "state": "revoked"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-14T20:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "state": {
                                                            "type": "string",
                                                            "enum": [
                                                                "active",
                                                                "revoked"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "state"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/trips/{uuid}/driver-messages": {
            "post": {
                "operationId": "trips.driver_messages.store",
                "description": "Sends a short message to the driver of one of your company's trips, as the dispatcher does in the panel; the driver reads it in the app and is told only that a message waits. The trip must have a driver; at most 5 messages in 10 minutes to one driver by keys, on top of the panel's own limits.\n\nRequires the key scope `logistics:trip_driver_messages:write`.",
                "summary": "Write to the driver of a trip",
                "tags": [
                    "TripDriverMessage"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/TripDriverMessageRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "body": {
                                                "type": "string",
                                                "description": "The message, 1 to 500 characters of plain text.",
                                                "examples": [
                                                    "Please call the depot before you leave."
                                                ]
                                            }
                                        },
                                        "required": [
                                            "body"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The message that was sent: its id only.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-14T20:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uuid": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "uuid"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/trips/{uuid}/file": {
            "get": {
                "operationId": "trips.file",
                "description": "The figures of the trip file page for one of your company's trips: the six stages (planned, assigned, loading, en route, delivered, closed) with the time each was reached and which is current, how late the latest drop-off arrival was against the planned end, the stops reached out of all the pickups and drop-offs, the stops of the line with their city and coordinates, when the vehicle last reported, the load against its capacity, the WASL registration state of the vehicle per activity and, for a key owner who may open the trip profit report and see drivers' pay and whose key also holds the scope `reporting:fleet_profitability:read`, the trip's money as the report words it (display lines per currency, never added across currencies). No person, phone or vehicle position is returned. A trip of another company or branch answers 404. Requires the key scope `logistics:trip_file:read`.\n\nRequires the key scope `logistics:trip_file:read`.",
                "summary": "Read the trip file figures",
                "tags": [
                    "TripFile"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The trip file figures.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "reference": "TRP-1001",
                                                "status": "en_route",
                                                "stages": [
                                                    {
                                                        "stage": "planned",
                                                        "at": "2026-06-01T05:00:00Z",
                                                        "status": "done"
                                                    }
                                                ],
                                                "delay_minutes": null,
                                                "stops": {
                                                    "reached": 1,
                                                    "total": 4,
                                                    "line": [
                                                        {
                                                            "city": "الرياض",
                                                            "kind": "pickup",
                                                            "state": "done",
                                                            "lat": 24.7136,
                                                            "lng": 46.6753
                                                        }
                                                    ]
                                                },
                                                "last_signal_at": "2026-06-01T08:30:00Z",
                                                "load": null,
                                                "compliance": [
                                                    {
                                                        "activity_code": "FREIGHT",
                                                        "registration_state": "active"
                                                    }
                                                ],
                                                "money": null
                                            },
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uuid": {
                                                    "type": "string"
                                                },
                                                "reference": {
                                                    "type": "string"
                                                },
                                                "status": {
                                                    "type": "string"
                                                },
                                                "planned_window": {
                                                    "type": "object",
                                                    "properties": {
                                                        "from": {
                                                            "type": "string"
                                                        },
                                                        "until": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "from",
                                                        "until"
                                                    ]
                                                },
                                                "stages": {
                                                    "type": "array",
                                                    "items": []
                                                },
                                                "delay_minutes": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "stops": {
                                                    "type": "object",
                                                    "properties": {
                                                        "reached": {
                                                            "type": "integer"
                                                        },
                                                        "total": {
                                                            "type": "integer"
                                                        },
                                                        "line": {
                                                            "type": "array",
                                                            "items": []
                                                        }
                                                    },
                                                    "required": [
                                                        "reached",
                                                        "total",
                                                        "line"
                                                    ]
                                                },
                                                "last_signal_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "load": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "carried": {
                                                            "type": "string"
                                                        },
                                                        "capacity": {
                                                            "type": "string"
                                                        },
                                                        "unit": {
                                                            "type": "string"
                                                        },
                                                        "percent": {
                                                            "type": "integer"
                                                        },
                                                        "over": {
                                                            "type": "boolean"
                                                        },
                                                        "uncounted": {
                                                            "type": "integer",
                                                            "minimum": 0
                                                        }
                                                    },
                                                    "required": [
                                                        "carried",
                                                        "capacity",
                                                        "unit",
                                                        "percent",
                                                        "over",
                                                        "uncounted"
                                                    ]
                                                },
                                                "compliance": {
                                                    "type": "array",
                                                    "items": []
                                                },
                                                "money": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "revenue": {
                                                            "type": "array",
                                                            "items": {
                                                                "type": "string"
                                                            }
                                                        },
                                                        "unpriced_orders": {
                                                            "type": "integer"
                                                        },
                                                        "fuel": {
                                                            "type": "array",
                                                            "items": {
                                                                "type": "string"
                                                            }
                                                        },
                                                        "maintenance": {
                                                            "type": "array",
                                                            "items": {
                                                                "type": "string"
                                                            }
                                                        },
                                                        "expenses": {
                                                            "type": "array",
                                                            "items": {
                                                                "type": "string"
                                                            }
                                                        },
                                                        "allowance": {
                                                            "type": [
                                                                "array",
                                                                "null"
                                                            ],
                                                            "items": {
                                                                "type": "string"
                                                            }
                                                        },
                                                        "margin": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "revenue",
                                                        "unpriced_orders",
                                                        "fuel",
                                                        "maintenance",
                                                        "expenses",
                                                        "allowance",
                                                        "margin"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "uuid",
                                                "reference",
                                                "status",
                                                "planned_window",
                                                "stages",
                                                "delay_minutes",
                                                "stops",
                                                "last_signal_at",
                                                "load",
                                                "compliance",
                                                "money"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/trips/{uuid}/proofs": {
            "get": {
                "operationId": "trips.proofs",
                "description": "Lists the delivery proofs recorded on one of your company's trips: the proof's id, its order, its kind, when it was recorded and whether the office recorded it. No file, receiver name, reason or position is returned. A trip of another company or branch answers 404.\n\nRequires the key scope `logistics:trip_records:read`.",
                "summary": "List the proofs of a trip",
                "tags": [
                    "TripRecord"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of proofs.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "page": {
                                                    "limit": 25,
                                                    "next_cursor": null
                                                }
                                            },
                                            "data": [
                                                {
                                                    "uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                    "order_uuid": "7c1d2f3e-1a2b-4c3d-8e9f-0a1b2c3d4e5f",
                                                    "kind": "signature",
                                                    "recorded_at": "2026-06-01T08:30:00Z",
                                                    "recorded_by_office": false
                                                }
                                            ]
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/trips/{uuid}/stop-facts": {
            "get": {
                "operationId": "trips.stop_facts",
                "description": "Lists what tracking observed at the trip's pickups and drop-offs, oldest first: the order, the fact, the visit number and the time. No position or distance is returned. The cursor is an opaque token for the next page and belongs to this trip.\n\nRequires the key scope `logistics:trip_records:read`.",
                "summary": "List the stop facts of a trip",
                "tags": [
                    "TripRecord"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Rows per page, 1 to 200 (default 100).",
                        "schema": {
                            "type": "integer"
                        },
                        "example": 100
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "The next_cursor of the previous page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of stop facts.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "page": {
                                                    "limit": 25,
                                                    "next_cursor": null
                                                }
                                            },
                                            "data": [
                                                {
                                                    "order_uuid": "7c1d2f3e-1a2b-4c3d-8e9f-0a1b2c3d4e5f",
                                                    "fact": "arrived_pickup",
                                                    "visit": 1,
                                                    "observed_at": "2026-06-01T07:45:00Z"
                                                }
                                            ]
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/trips/{uuid}/reports": {
            "get": {
                "operationId": "trips.reports",
                "description": "Lists the stop reports recorded on one of your company's trips: the report's id, its order, its kind, when it was made and whether the office made it. No reason or person is returned.\n\nRequires the key scope `logistics:trip_records:read`.",
                "summary": "List the stop reports of a trip",
                "tags": [
                    "TripRecord"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of stop reports.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "page": {
                                                    "limit": 25,
                                                    "next_cursor": null
                                                }
                                            },
                                            "data": [
                                                {
                                                    "uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a12",
                                                    "order_uuid": "7c1d2f3e-1a2b-4c3d-8e9f-0a1b2c3d4e5f",
                                                    "kind": "delay",
                                                    "reported_at": "2026-06-01T08:00:00Z",
                                                    "recorded_by_office": false
                                                }
                                            ]
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/trips/{uuid}/history": {
            "get": {
                "operationId": "trips.history",
                "description": "Lists the state changes of one of your company's trips, oldest first: the two states, when it happened, its kind (moved, window_changed or recorded), the kind of actor (user, driver or system) and, only for a cancellation, its reason, or for a change of window the old and new window. No person is returned. The cursor is an opaque token for the next page and belongs to this trip. A trip of another company or branch answers 404.\n\nRequires the key scope `logistics:trip_records:read`.",
                "summary": "List the history of a trip",
                "tags": [
                    "TripRecord"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Rows per page, 1 to 200 (default 100).",
                        "schema": {
                            "type": "integer"
                        },
                        "example": 100
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "The next_cursor of the previous page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of history entries.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "page": {
                                                    "limit": 25,
                                                    "next_cursor": null
                                                }
                                            },
                                            "data": [
                                                {
                                                    "from_status": "planned",
                                                    "to_status": "assigned",
                                                    "at": "2026-06-01T06:00:00Z",
                                                    "kind": "moved",
                                                    "actor_kind": "user",
                                                    "note": null,
                                                    "window": null
                                                }
                                            ]
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/trips/summary": {
            "get": {
                "operationId": "trips.summary",
                "description": "The figures above the trips list: how many trips are in each state and how many are still open, how many need a person now (late beyond the manager's tolerance, silent beyond the tracking limit, or delivered and waiting too long to be closed), what waits and the time of the oldest wait (unassigned, unassigned for tomorrow, late now, without a signal, waiting to close) and how the last 14 Saudi days ended (delivered, delivered late, cancelled per day). Counts and times only: no plate, driver, price or coordinate. The silent counts and the silent part of the attention count are given only when the key also holds `positions:read` and its owner may see the live map. Requires the key scope `logistics:trips_summary:read` and the view right.\n\nRequires the key scope `logistics:trips_summary:read`.",
                "summary": "Read the trips summary",
                "tags": [
                    "TripsSummary"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The summary.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "states": {
                                                    "planned": 2,
                                                    "assigned": 1,
                                                    "loading": 0,
                                                    "en_route": 3,
                                                    "delivered": 1,
                                                    "closed": 40,
                                                    "cancelled": 2
                                                },
                                                "open": 7,
                                                "attention": 2,
                                                "waiting": {
                                                    "unassigned": {
                                                        "count": 2,
                                                        "since": "2026-11-19T06:00:00Z"
                                                    },
                                                    "unassigned_tomorrow": 1,
                                                    "late": {
                                                        "count": 1,
                                                        "minutes": 35
                                                    },
                                                    "silent": {
                                                        "count": null,
                                                        "minutes": null,
                                                        "unavailable": "silence_denied"
                                                    },
                                                    "to_close": {
                                                        "count": 1,
                                                        "since": "2026-11-19T14:00:00Z"
                                                    }
                                                },
                                                "outcome": {
                                                    "days": 14,
                                                    "daily": [
                                                        {
                                                            "date": "2026-11-19",
                                                            "delivered": 3,
                                                            "late": 1,
                                                            "cancelled": 0
                                                        }
                                                    ],
                                                    "unavailable": null
                                                }
                                            },
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-19T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "states": {
                                                    "type": "string"
                                                },
                                                "open": {
                                                    "type": "number"
                                                },
                                                "attention": {
                                                    "type": "integer",
                                                    "minimum": 0
                                                },
                                                "waiting": {
                                                    "type": "object",
                                                    "properties": {
                                                        "unassigned": {
                                                            "type": "object",
                                                            "properties": {
                                                                "count": {
                                                                    "type": "integer"
                                                                },
                                                                "since": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "count",
                                                                "since"
                                                            ]
                                                        },
                                                        "unassigned_tomorrow": {
                                                            "type": "integer"
                                                        },
                                                        "late": {
                                                            "type": "object",
                                                            "properties": {
                                                                "count": {
                                                                    "type": "integer"
                                                                },
                                                                "minutes": {
                                                                    "type": [
                                                                        "integer",
                                                                        "null"
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "count",
                                                                "minutes"
                                                            ]
                                                        },
                                                        "silent": {
                                                            "type": "object",
                                                            "properties": {
                                                                "count": {
                                                                    "type": [
                                                                        "integer",
                                                                        "null"
                                                                    ]
                                                                },
                                                                "minutes": {
                                                                    "type": [
                                                                        "integer",
                                                                        "null"
                                                                    ]
                                                                },
                                                                "unavailable": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "count",
                                                                "minutes",
                                                                "unavailable"
                                                            ]
                                                        },
                                                        "to_close": {
                                                            "type": "object",
                                                            "properties": {
                                                                "count": {
                                                                    "type": "integer"
                                                                },
                                                                "since": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "count",
                                                                "since"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "unassigned",
                                                        "unassigned_tomorrow",
                                                        "late",
                                                        "silent",
                                                        "to_close"
                                                    ]
                                                },
                                                "outcome": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "days": {
                                                                    "type": "integer",
                                                                    "const": 14
                                                                },
                                                                "daily": {
                                                                    "type": "array",
                                                                    "items": {
                                                                        "type": "string"
                                                                    },
                                                                    "minItems": 0,
                                                                    "maxItems": 0
                                                                },
                                                                "unavailable": {
                                                                    "type": "string",
                                                                    "const": "too_many"
                                                                }
                                                            },
                                                            "required": [
                                                                "days",
                                                                "daily",
                                                                "unavailable"
                                                            ]
                                                        },
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "days": {
                                                                    "type": "integer",
                                                                    "const": 14
                                                                },
                                                                "daily": {
                                                                    "type": "array",
                                                                    "items": []
                                                                },
                                                                "unavailable": {
                                                                    "type": "null"
                                                                }
                                                            },
                                                            "required": [
                                                                "days",
                                                                "daily",
                                                                "unavailable"
                                                            ]
                                                        },
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "days": {
                                                                    "type": "integer",
                                                                    "const": 14
                                                                },
                                                                "daily": {
                                                                    "type": "array",
                                                                    "items": {
                                                                        "type": "string"
                                                                    },
                                                                    "minItems": 0,
                                                                    "maxItems": 0
                                                                },
                                                                "unavailable": {
                                                                    "type": "string",
                                                                    "const": "read_failed"
                                                                }
                                                            },
                                                            "required": [
                                                                "days",
                                                                "daily",
                                                                "unavailable"
                                                            ]
                                                        }
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "states",
                                                "open",
                                                "attention",
                                                "waiting",
                                                "outcome"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/vehicles": {
            "get": {
                "operationId": "vehicles.index",
                "description": "Lists your company's vehicles, oldest first, one page at a time. Archived vehicles are left out unless you ask for status=archived. A branch-limited key sees only its own branch (records shared with your branch are included; their branch_uuid is empty). Times are UTC; meta.timezone names the platform time zone.\n\nRequires the key scope `vehicles:read`.",
                "summary": "List vehicles",
                "tags": [
                    "Vehicle"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only vehicles in this state.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "active"
                    },
                    {
                        "name": "branch",
                        "in": "query",
                        "description": "Only vehicles of this branch (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only vehicles changed at or after this moment (ISO 8601 with an offset, e.g. 2026-05-01T00:00:00Z).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "class",
                        "in": "query",
                        "description": "Only vehicles whose type belongs to this class (its code, as the vehicle's class field shows it).",
                        "schema": {
                            "type": "string"
                        },
                        "example": "heavy_truck"
                    },
                    {
                        "name": "type",
                        "in": "query",
                        "description": "Only vehicles of this type (its code, as the vehicle's type field shows it).",
                        "schema": {
                            "type": "string"
                        },
                        "example": "tractor_unit"
                    },
                    {
                        "name": "make",
                        "in": "query",
                        "description": "Only vehicles of this make (its code, as make_code shows it).",
                        "schema": {
                            "type": "string"
                        },
                        "example": "mercedes_benz"
                    },
                    {
                        "name": "model",
                        "in": "query",
                        "description": "Only vehicles of this model (its code, as model_code shows it); a model code is read inside its make, so make is required with it.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "actros"
                    },
                    {
                        "name": "year_from",
                        "in": "query",
                        "description": "Only vehicles built in this year or later.",
                        "schema": {
                            "type": "integer"
                        },
                        "example": 2018
                    },
                    {
                        "name": "year_to",
                        "in": "query",
                        "description": "Only vehicles built in this year or earlier; not before year_from.",
                        "schema": {
                            "type": "integer"
                        },
                        "example": 2024
                    },
                    {
                        "name": "plate_number",
                        "in": "query",
                        "description": "Only vehicles whose plate digits are exactly these (1 to 8 digits, as plate_number shows them); several vehicles may share digits with different letters.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "1234"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of vehicles.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                    "status": "active",
                                                    "sequence_number": "123456789",
                                                    "plate_number": "1234",
                                                    "plate_right_letter": "أ",
                                                    "plate_middle_letter": "ب",
                                                    "plate_left_letter": "ج",
                                                    "plate_type": 1,
                                                    "latin_plate": null,
                                                    "vin": "WDB9634031L123456",
                                                    "make": "Mercedes-Benz",
                                                    "make_code": "mercedes_benz",
                                                    "model": "Actros",
                                                    "model_code": "actros",
                                                    "model_version_code": "actros_mp4",
                                                    "variant_code": "actros_1845_4x2",
                                                    "manufacture_year": 2022,
                                                    "type": "truck",
                                                    "class": "heavy_truck",
                                                    "category": "heavy",
                                                    "body_type": "flatbed",
                                                    "colour": "white",
                                                    "ownership_type": "owned",
                                                    "display_name": {
                                                        "ar": "شاحنة 12",
                                                        "en": "Truck 12"
                                                    },
                                                    "capacity_value": "20.000",
                                                    "capacity_unit": "ton",
                                                    "fuel_consumption_l_per_100km": "32.5",
                                                    "equipment_serial_number": null,
                                                    "hours_meter_reading": null,
                                                    "coupling_type": "fifth_wheel",
                                                    "max_combination_weight_kg": 44000,
                                                    "thumbnail_url": "https://api.example.com/api/v1/vehicles/0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11/photo/thumbnail",
                                                    "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                    "legal_operator_uuid": "7a9c3d2e-1b44-4a6f-9c5d-6e8f0a1b2c33",
                                                    "archived_at": null,
                                                    "created_at": "2026-03-01T08:30:00Z",
                                                    "updated_at": "2026-05-12T11:05:42Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "post": {
                "operationId": "vehicles.store",
                "description": "Registers a road vehicle of your company, as the panel does: the sequence number, the plate (number and three letters), the plate type and the legal operator by its uuid, optionally the VIN, the model year, the vehicle type code and the catalogue make and model by code. Every plate, sequence number, plan-limit, licence and identity check of the panel applies and a refusal answers 422 with the field; at most 30 registrations an hour for the company. Equipment, ownership, catalogue versions, branch and visibility are set in the panel. Requires the key scope `fleet:vehicles:register`, its owner's right to create vehicles, and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:vehicles:register`.",
                "summary": "Register a vehicle",
                "tags": [
                    "VehicleRegister"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/RegisterVehicleRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "sequence_number": {
                                                "type": "string",
                                                "description": "The registration sequence number, digits only.",
                                                "examples": [
                                                    "70012345"
                                                ]
                                            },
                                            "plate_number": {
                                                "type": "string",
                                                "description": "The plate digits.",
                                                "examples": [
                                                    "1234"
                                                ]
                                            },
                                            "plate_right_letter": {
                                                "type": "string",
                                                "description": "The right letter of the plate, as on the registration card.",
                                                "examples": [
                                                    "A"
                                                ]
                                            },
                                            "plate_middle_letter": {
                                                "type": "string",
                                                "description": "The middle letter of the plate.",
                                                "examples": [
                                                    "B"
                                                ]
                                            },
                                            "plate_left_letter": {
                                                "type": "string",
                                                "description": "The left letter of the plate.",
                                                "examples": [
                                                    "C"
                                                ]
                                            },
                                            "plate_type": {
                                                "type": "integer",
                                                "description": "The plate type number, 1 to 99, as on the registration card.",
                                                "examples": [
                                                    1
                                                ]
                                            },
                                            "legal_operator_uuid": {
                                                "type": "string",
                                                "format": "uuid",
                                                "description": "The legal operator the vehicle works under, by uuid. It must be one of your company's active operators; list them with GET /legal-operators (scope vehicles read), or read it from a vehicle you already have as legal_operator_uuid. Any other uuid answers 422 on this field.",
                                                "examples": [
                                                    "7a9c3d2e-1b44-4a6f-9c5d-6e8f0a1b2c33"
                                                ]
                                            },
                                            "vin": {
                                                "type": "string",
                                                "description": "The vehicle identification number, up to 17 characters.",
                                                "examples": [
                                                    "WDB9634031L123456"
                                                ]
                                            },
                                            "manufacture_year": {
                                                "type": "integer",
                                                "description": "The model year.",
                                                "examples": [
                                                    2022
                                                ]
                                            },
                                            "vehicle_type_code": {
                                                "type": "string",
                                                "description": "The vehicle type code, from GET /vehicle-catalogue/types.",
                                                "examples": [
                                                    "tractor_unit"
                                                ]
                                            },
                                            "make_code": {
                                                "type": "string",
                                                "description": "The catalogue make code, from GET /vehicle-catalogue/makes; an unknown code answers 422 on this field. Send it with model_code or alone.",
                                                "examples": [
                                                    "volvo"
                                                ]
                                            },
                                            "model_code": {
                                                "type": "string",
                                                "description": "The catalogue model code of that make, from GET /vehicle-catalogue/models.",
                                                "examples": [
                                                    "fh16"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "sequence_number",
                                            "plate_number",
                                            "plate_right_letter",
                                            "plate_middle_letter",
                                            "plate_left_letter",
                                            "plate_type",
                                            "legal_operator_uuid"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The vehicle that was registered.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "status": "active",
                                                "sequence_number": "123456789",
                                                "plate_number": "1234",
                                                "plate_right_letter": "أ",
                                                "plate_middle_letter": "ب",
                                                "plate_left_letter": "ج",
                                                "plate_type": 1,
                                                "latin_plate": null,
                                                "vin": "WDB9634031L123456",
                                                "make": "Mercedes-Benz",
                                                "make_code": "mercedes_benz",
                                                "model": "Actros",
                                                "model_code": "actros",
                                                "model_version_code": "actros_mp4",
                                                "variant_code": "actros_1845_4x2",
                                                "manufacture_year": 2022,
                                                "type": "truck",
                                                "class": "heavy_truck",
                                                "category": "heavy",
                                                "body_type": "flatbed",
                                                "colour": "white",
                                                "ownership_type": "owned",
                                                "display_name": {
                                                    "ar": "شاحنة 12",
                                                    "en": "Truck 12"
                                                },
                                                "capacity_value": "20.000",
                                                "capacity_unit": "ton",
                                                "fuel_consumption_l_per_100km": "32.5",
                                                "equipment_serial_number": null,
                                                "hours_meter_reading": null,
                                                "coupling_type": "fifth_wheel",
                                                "max_combination_weight_kg": 44000,
                                                "thumbnail_url": "https://api.example.com/api/v1/vehicles/0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11/photo/thumbnail",
                                                "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                "legal_operator_uuid": "7a9c3d2e-1b44-4a6f-9c5d-6e8f0a1b2c33",
                                                "archived_at": null,
                                                "created_at": "2026-03-01T08:30:00Z",
                                                "updated_at": "2026-05-12T11:05:42Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uuid": {
                                                    "type": "string"
                                                },
                                                "status": {
                                                    "type": "string"
                                                },
                                                "sequence_number": {
                                                    "type": "string"
                                                },
                                                "plate_number": {
                                                    "type": "string"
                                                },
                                                "plate_right_letter": {
                                                    "type": "string"
                                                },
                                                "plate_middle_letter": {
                                                    "type": "string"
                                                },
                                                "plate_left_letter": {
                                                    "type": "string"
                                                },
                                                "plate_type": {
                                                    "type": "string"
                                                },
                                                "latin_plate": {
                                                    "type": "string"
                                                },
                                                "vin": {
                                                    "type": "string"
                                                },
                                                "make": {
                                                    "type": "string"
                                                },
                                                "make_code": {
                                                    "type": "string"
                                                },
                                                "model": {
                                                    "type": "string"
                                                },
                                                "model_code": {
                                                    "type": "string"
                                                },
                                                "model_version_code": {
                                                    "type": "string"
                                                },
                                                "variant_code": {
                                                    "type": "string"
                                                },
                                                "manufacture_year": {
                                                    "type": "string"
                                                },
                                                "type": {
                                                    "type": "string"
                                                },
                                                "class": {
                                                    "type": "string"
                                                },
                                                "category": {
                                                    "type": "string"
                                                },
                                                "body_type": {
                                                    "type": "string"
                                                },
                                                "colour": {
                                                    "type": "string"
                                                },
                                                "ownership_type": {
                                                    "type": "string"
                                                },
                                                "display_name": {
                                                    "type": "string"
                                                },
                                                "capacity_value": {
                                                    "type": "string"
                                                },
                                                "capacity_unit": {
                                                    "type": "string"
                                                },
                                                "fuel_consumption_l_per_100km": {
                                                    "type": "string"
                                                },
                                                "equipment_serial_number": {
                                                    "type": "string"
                                                },
                                                "hours_meter_reading": {
                                                    "type": "string"
                                                },
                                                "coupling_type": {
                                                    "type": "null"
                                                },
                                                "max_combination_weight_kg": {
                                                    "type": "null"
                                                },
                                                "thumbnail_url": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "branch_uuid": {
                                                    "type": "string"
                                                },
                                                "legal_operator_uuid": {
                                                    "type": "string"
                                                },
                                                "archived_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "uuid",
                                                "status",
                                                "sequence_number",
                                                "plate_number",
                                                "plate_right_letter",
                                                "plate_middle_letter",
                                                "plate_left_letter",
                                                "plate_type",
                                                "latin_plate",
                                                "vin",
                                                "make",
                                                "make_code",
                                                "model",
                                                "model_code",
                                                "model_version_code",
                                                "variant_code",
                                                "manufacture_year",
                                                "type",
                                                "class",
                                                "category",
                                                "body_type",
                                                "colour",
                                                "ownership_type",
                                                "display_name",
                                                "capacity_value",
                                                "capacity_unit",
                                                "fuel_consumption_l_per_100km",
                                                "equipment_serial_number",
                                                "hours_meter_reading",
                                                "coupling_type",
                                                "max_combination_weight_kg",
                                                "thumbnail_url",
                                                "branch_uuid",
                                                "legal_operator_uuid",
                                                "archived_at",
                                                "created_at",
                                                "updated_at"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/vehicles/{uuid}": {
            "get": {
                "operationId": "vehicles.show",
                "description": "Reads one of your company's vehicles by its uuid. A vehicle of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `vehicles:read`.",
                "summary": "Read a vehicle",
                "tags": [
                    "Vehicle"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The vehicle.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "status": "active",
                                                "sequence_number": "123456789",
                                                "plate_number": "1234",
                                                "plate_right_letter": "أ",
                                                "plate_middle_letter": "ب",
                                                "plate_left_letter": "ج",
                                                "plate_type": 1,
                                                "latin_plate": null,
                                                "vin": "WDB9634031L123456",
                                                "make": "Mercedes-Benz",
                                                "make_code": "mercedes_benz",
                                                "model": "Actros",
                                                "model_code": "actros",
                                                "model_version_code": "actros_mp4",
                                                "variant_code": "actros_1845_4x2",
                                                "manufacture_year": 2022,
                                                "type": "truck",
                                                "class": "heavy_truck",
                                                "category": "heavy",
                                                "body_type": "flatbed",
                                                "colour": "white",
                                                "ownership_type": "owned",
                                                "display_name": {
                                                    "ar": "شاحنة 12",
                                                    "en": "Truck 12"
                                                },
                                                "capacity_value": "20.000",
                                                "capacity_unit": "ton",
                                                "fuel_consumption_l_per_100km": "32.5",
                                                "equipment_serial_number": null,
                                                "hours_meter_reading": null,
                                                "coupling_type": "fifth_wheel",
                                                "max_combination_weight_kg": 44000,
                                                "thumbnail_url": "https://api.example.com/api/v1/vehicles/0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11/photo/thumbnail",
                                                "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                "legal_operator_uuid": "7a9c3d2e-1b44-4a6f-9c5d-6e8f0a1b2c33",
                                                "archived_at": null,
                                                "created_at": "2026-03-01T08:30:00Z",
                                                "updated_at": "2026-05-12T11:05:42Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "additionalProperties": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "put": {
                "operationId": "vehicles.update",
                "description": "Changes the descriptive fields of one of your company's vehicles, as the panel does. Send the `row_version` you read: a vehicle changed meanwhile, or a body without it, answers 409. The hours meter of equipment can only go up; a capacity cannot change while the vehicle holds a live market commitment. Plate, sequence number, VIN, identifier kind, legal operator, ownership, vehicle type, catalogue, branch and archive are changed in the panel and any such key is refused. `fuel_consumption_l_per_100km` only feeds the fuel estimate. Requires the key scope `fleet:vehicles:write`, its owner's right to update vehicles, and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:vehicles:write`.",
                "summary": "Change a vehicle",
                "tags": [
                    "VehicleWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/UpdateVehicleRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The version of the vehicle you read.",
                                                "examples": [
                                                    3
                                                ]
                                            },
                                            "display_name": {
                                                "type": "object",
                                                "description": "The name in Arabic and English, plain text up to 100 characters each.",
                                                "examples": [
                                                    {
                                                        "ar": "شاحنة 12",
                                                        "en": "Truck 12"
                                                    }
                                                ]
                                            },
                                            "hours_meter_reading": {
                                                "type": "string",
                                                "description": "Equipment only; a reading lower than the stored one needs hours_meter_reason.",
                                                "examples": [
                                                    "1200.5"
                                                ]
                                            },
                                            "hours_meter_reason": {
                                                "type": "string",
                                                "description": "The reason for a lower hours meter reading, a plain sentence of at least 10 characters; ignored when the reading does not go down.",
                                                "examples": [
                                                    "The meter was replaced"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The vehicle after the change.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "status": "active",
                                                "sequence_number": "123456789",
                                                "plate_number": "1234",
                                                "plate_right_letter": "أ",
                                                "plate_middle_letter": "ب",
                                                "plate_left_letter": "ج",
                                                "plate_type": 1,
                                                "latin_plate": null,
                                                "vin": "WDB9634031L123456",
                                                "make": "Mercedes-Benz",
                                                "make_code": "mercedes_benz",
                                                "model": "Actros",
                                                "model_code": "actros",
                                                "model_version_code": "actros_mp4",
                                                "variant_code": "actros_1845_4x2",
                                                "manufacture_year": 2022,
                                                "type": "truck",
                                                "class": "heavy_truck",
                                                "category": "heavy",
                                                "body_type": "flatbed",
                                                "colour": "white",
                                                "ownership_type": "owned",
                                                "display_name": {
                                                    "ar": "شاحنة 12",
                                                    "en": "Truck 12"
                                                },
                                                "capacity_value": "20.000",
                                                "capacity_unit": "ton",
                                                "fuel_consumption_l_per_100km": "32.5",
                                                "equipment_serial_number": null,
                                                "hours_meter_reading": null,
                                                "coupling_type": "fifth_wheel",
                                                "max_combination_weight_kg": 44000,
                                                "thumbnail_url": "https://api.example.com/api/v1/vehicles/0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11/photo/thumbnail",
                                                "branch_uuid": "5d1f0f4a-52f6-4e3b-8f8e-0c1f2b7e9a22",
                                                "legal_operator_uuid": "7a9c3d2e-1b44-4a6f-9c5d-6e8f0a1b2c33",
                                                "archived_at": null,
                                                "created_at": "2026-03-01T08:30:00Z",
                                                "updated_at": "2026-05-12T11:05:42Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "sequence_number": {
                                                            "type": "string"
                                                        },
                                                        "plate_number": {
                                                            "type": "string"
                                                        },
                                                        "plate_right_letter": {
                                                            "type": "string"
                                                        },
                                                        "plate_middle_letter": {
                                                            "type": "string"
                                                        },
                                                        "plate_left_letter": {
                                                            "type": "string"
                                                        },
                                                        "plate_type": {
                                                            "type": "string"
                                                        },
                                                        "latin_plate": {
                                                            "type": "string"
                                                        },
                                                        "vin": {
                                                            "type": "string"
                                                        },
                                                        "make": {
                                                            "type": "string"
                                                        },
                                                        "make_code": {
                                                            "type": "string"
                                                        },
                                                        "model": {
                                                            "type": "string"
                                                        },
                                                        "model_code": {
                                                            "type": "string"
                                                        },
                                                        "model_version_code": {
                                                            "type": "string"
                                                        },
                                                        "variant_code": {
                                                            "type": "string"
                                                        },
                                                        "manufacture_year": {
                                                            "type": "string"
                                                        },
                                                        "type": {
                                                            "type": "string"
                                                        },
                                                        "class": {
                                                            "type": "string"
                                                        },
                                                        "category": {
                                                            "type": "string"
                                                        },
                                                        "body_type": {
                                                            "type": "string"
                                                        },
                                                        "colour": {
                                                            "type": "string"
                                                        },
                                                        "ownership_type": {
                                                            "type": "string"
                                                        },
                                                        "display_name": {
                                                            "type": "string"
                                                        },
                                                        "capacity_value": {
                                                            "type": "string"
                                                        },
                                                        "capacity_unit": {
                                                            "type": "string"
                                                        },
                                                        "fuel_consumption_l_per_100km": {
                                                            "type": "string"
                                                        },
                                                        "equipment_serial_number": {
                                                            "type": "string"
                                                        },
                                                        "hours_meter_reading": {
                                                            "type": "string"
                                                        },
                                                        "coupling_type": {
                                                            "type": "null"
                                                        },
                                                        "max_combination_weight_kg": {
                                                            "type": "null"
                                                        },
                                                        "thumbnail_url": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "branch_uuid": {
                                                            "type": "string"
                                                        },
                                                        "legal_operator_uuid": {
                                                            "type": "string"
                                                        },
                                                        "archived_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "status",
                                                        "sequence_number",
                                                        "plate_number",
                                                        "plate_right_letter",
                                                        "plate_middle_letter",
                                                        "plate_left_letter",
                                                        "plate_type",
                                                        "latin_plate",
                                                        "vin",
                                                        "make",
                                                        "make_code",
                                                        "model",
                                                        "model_code",
                                                        "model_version_code",
                                                        "variant_code",
                                                        "manufacture_year",
                                                        "type",
                                                        "class",
                                                        "category",
                                                        "body_type",
                                                        "colour",
                                                        "ownership_type",
                                                        "display_name",
                                                        "capacity_value",
                                                        "capacity_unit",
                                                        "fuel_consumption_l_per_100km",
                                                        "equipment_serial_number",
                                                        "hours_meter_reading",
                                                        "coupling_type",
                                                        "max_combination_weight_kg",
                                                        "thumbnail_url",
                                                        "branch_uuid",
                                                        "legal_operator_uuid",
                                                        "archived_at",
                                                        "created_at",
                                                        "updated_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/vehicle-calendar": {
            "get": {
                "operationId": "vehicle_calendar.index",
                "description": "For each vehicle of the company and each Saudi day from `from` to `until` (at most 62 days), what the vehicle holds that day: its trips (planned, live, late or finished) by uuid, whether the workshop holds it for the whole day, the plan or inspection that falls due, an open critical fault, the main driver's leave kind (only for a key that also holds the leave scope and an owner who may read leave) and whether it has a main driver; the kind of the day (finished, live, late, planned, workshop, leave, idle for a past day with no trip, free for a future one); and the fleet's use over the days that have come. Vehicles are named by uuid and plate; no driver is named. A stretch that would draw more than 20,000 vehicle-days is refused with 422. Requires the key scope `logistics:vehicle_calendar:read` and the rights to see trips and maintenance.\n\nRequires the key scope `logistics:vehicle_calendar:read`.",
                "summary": "Read the vehicle calendar",
                "tags": [
                    "VehicleCalendar"
                ],
                "parameters": [
                    {
                        "name": "from",
                        "in": "query",
                        "required": true,
                        "description": "The first day, Y-m-d.",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "until",
                        "in": "query",
                        "required": true,
                        "description": "The last day, Y-m-d, not before the first and at most 62 days from it.",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "empty_only",
                        "in": "query",
                        "description": "Only the vehicles that have an empty day in the stretch.",
                        "schema": {
                            "type": "boolean"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The calendar.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "from": "2026-11-14",
                                                "until": "2026-11-20",
                                                "truncated": false,
                                                "figures": {
                                                    "use_percent": 43,
                                                    "worked_days": 6,
                                                    "available_days": 14,
                                                    "idle_days": 8,
                                                    "in_workshop_today": 1,
                                                    "due_soon": 2,
                                                    "overdue": 1
                                                },
                                                "vehicles": [
                                                    {
                                                        "vehicle_uuid": "3c1e9a52-8d47-4b6a-a2f0-5e7d9b4c1a44",
                                                        "plate": "ر س ط 7310",
                                                        "overdue": false,
                                                        "next_due_on": "2026-11-25",
                                                        "days": [
                                                            {
                                                                "date": "2026-11-14",
                                                                "kind": "finished",
                                                                "available": true,
                                                                "trips": [
                                                                    {
                                                                        "trip_uuid": "9f1c2d3e-4b5a-6c7d-8e9f-0a1b2c3d4e5f",
                                                                        "reference": "T-118",
                                                                        "group": "finished",
                                                                        "from": "2026-11-14T03:00:00Z",
                                                                        "until": "2026-11-14T09:00:00Z"
                                                                    }
                                                                ],
                                                                "workshop": false,
                                                                "due_kinds": [],
                                                                "fault": false,
                                                                "leave": null,
                                                                "has_driver": true
                                                            }
                                                        ]
                                                    }
                                                ]
                                            },
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-20T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "from": {
                                                    "type": "string"
                                                },
                                                "until": {
                                                    "type": "string"
                                                },
                                                "truncated": {
                                                    "type": "boolean"
                                                },
                                                "figures": {
                                                    "type": "object",
                                                    "properties": {
                                                        "use_percent": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ]
                                                        },
                                                        "worked_days": {
                                                            "type": "integer",
                                                            "const": 0
                                                        },
                                                        "available_days": {
                                                            "type": "integer",
                                                            "const": 0
                                                        },
                                                        "idle_days": {
                                                            "type": "integer",
                                                            "const": 0
                                                        },
                                                        "in_workshop_today": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ],
                                                            "enum": [
                                                                0,
                                                                null
                                                            ]
                                                        },
                                                        "due_soon": {
                                                            "type": "integer",
                                                            "const": 0
                                                        },
                                                        "overdue": {
                                                            "type": "integer",
                                                            "const": 0
                                                        }
                                                    },
                                                    "required": [
                                                        "use_percent",
                                                        "worked_days",
                                                        "available_days",
                                                        "idle_days",
                                                        "in_workshop_today",
                                                        "due_soon",
                                                        "overdue"
                                                    ]
                                                },
                                                "vehicles": {
                                                    "type": "array",
                                                    "items": []
                                                }
                                            },
                                            "required": [
                                                "from",
                                                "until",
                                                "truncated",
                                                "figures",
                                                "vehicles"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/vehicle-catalogue/makes": {
            "get": {
                "operationId": "vehicle_catalogue.makes.index",
                "description": "Lists the makes of the vehicle catalogue by code, one page at a time. Only active, reviewed makes are listed.\n\nRequires the key scope `vehicles:read`.",
                "summary": "List vehicle makes",
                "tags": [
                    "VehicleCatalogue"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of makes.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "code": "mercedes_benz",
                                                    "name_ar": "مرسيدس بنز",
                                                    "name_en": "Mercedes-Benz"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "string"
                                            }
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/vehicle-catalogue/models": {
            "get": {
                "operationId": "vehicle_catalogue.models.index",
                "description": "Lists the models of the vehicle catalogue, one page at a time, each with the code of its make. Only active, reviewed models of active, reviewed makes are listed.\n\nRequires the key scope `vehicles:read`.",
                "summary": "List vehicle models",
                "tags": [
                    "VehicleCatalogue"
                ],
                "parameters": [
                    {
                        "name": "make",
                        "in": "query",
                        "description": "Only the models of this make (its code).",
                        "schema": {
                            "type": "string"
                        },
                        "example": "mercedes_benz"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of models.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "code": "actros",
                                                    "make_code": "mercedes_benz",
                                                    "name_ar": "أكتروس",
                                                    "name_en": "Actros",
                                                    "default_type_code": "tractor_unit"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "string"
                                            }
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/vehicle-catalogue/types": {
            "get": {
                "operationId": "vehicle_catalogue.types.index",
                "description": "Lists the vehicle types of the catalogue by code, one page at a time, each with the code of its class. Only active, reviewed types are listed.\n\nRequires the key scope `vehicles:read`.",
                "summary": "List vehicle types",
                "tags": [
                    "VehicleCatalogue"
                ],
                "parameters": [
                    {
                        "name": "class",
                        "in": "query",
                        "description": "Only the types of this class (its code).",
                        "schema": {
                            "type": "string"
                        },
                        "example": "heavy_truck"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of types.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "code": "tractor_unit",
                                                    "class_code": "heavy_truck",
                                                    "name_ar": "رأس شاحنة",
                                                    "name_en": "Tractor unit"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "string"
                                            }
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/vehicle-catalogue/versions": {
            "get": {
                "operationId": "vehicle_catalogue.versions.index",
                "description": "Lists the versions of the vehicle catalogue, one page at a time, each with the codes of its model and make and the years it was built. A version is identified by `make.model.version`. Only active, reviewed versions of active, reviewed models and makes are listed.\n\nRequires the key scope `vehicles:read`.",
                "summary": "List vehicle model versions",
                "tags": [
                    "VehicleCatalogue"
                ],
                "parameters": [
                    {
                        "name": "model",
                        "in": "query",
                        "description": "Only the versions of this model, as `make.model`.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "mercedes_benz.actros"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of versions.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "code": "mp4",
                                                    "make_code": "mercedes_benz",
                                                    "model_code": "actros",
                                                    "name_ar": "الجيل الرابع",
                                                    "name_en": "MP4",
                                                    "year_from": 2011,
                                                    "year_to": 2018
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "string"
                                            }
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/vehicle-catalogue/variants": {
            "get": {
                "operationId": "vehicle_catalogue.variants.index",
                "description": "Lists the variants of the vehicle catalogue, one page at a time, each with the codes of its version, model and make and its technical figures. A variant is identified by `make.model.version.variant`. Only active, reviewed variants of active, reviewed versions, models and makes are listed.\n\nRequires the key scope `vehicles:read`.",
                "summary": "List vehicle variants",
                "tags": [
                    "VehicleCatalogue"
                ],
                "parameters": [
                    {
                        "name": "version",
                        "in": "query",
                        "description": "Only the variants of this version, as `make.model.version`.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "mercedes_benz.actros.mp4"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of variants.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "code": "1845",
                                                    "make_code": "mercedes_benz",
                                                    "model_code": "actros",
                                                    "version_code": "mp4",
                                                    "name_ar": "1845",
                                                    "name_en": "1845",
                                                    "axle_configuration": "4x2",
                                                    "axle_count": 2,
                                                    "gross_weight_kg": 18000,
                                                    "engine_displacement_cc": 12809,
                                                    "engine_power_kw": "330.0",
                                                    "fuel_type_code": "diesel",
                                                    "cab_type": "sleeper"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "string"
                                            }
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/vehicle-catalogue/classes": {
            "get": {
                "operationId": "vehicle_catalogue.classes.index",
                "description": "Lists the vehicle classes of the catalogue by code, one page at a time. Only active, reviewed classes are listed.\n\nRequires the key scope `vehicles:read`.",
                "summary": "List vehicle classes",
                "tags": [
                    "VehicleCatalogue"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of classes.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "code": "heavy_truck",
                                                    "name_ar": "شاحنة ثقيلة",
                                                    "name_en": "Heavy truck"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "string"
                                            }
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/vehicle-catalogue/body-types": {
            "get": {
                "operationId": "vehicle_catalogue.body_types.index",
                "description": "Lists the body types of the catalogue by code, one page at a time, with the flags that say a body is a tank, a vehicle carrier or refrigerated. Only active, reviewed body types are listed.\n\nRequires the key scope `vehicles:read`.",
                "summary": "List body types",
                "tags": [
                    "VehicleCatalogue"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of body types.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "code": "tanker",
                                                    "name_ar": "صهريج",
                                                    "name_en": "Tanker",
                                                    "is_tank": true,
                                                    "is_vehicle_carrier": false,
                                                    "is_refrigerated": false
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "string"
                                            }
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/reports/comparison": {
            "get": {
                "operationId": "reports.comparison",
                "description": "Compares two to six of your vehicles over a period, measure by measure: distance, moving hours, idle hours, the idle share and trips; a key whose owner may see expenses also gets the expenses of each currency and the expenses per 10,000 km. The first vehicle is the reference; every other cell shows its change from it. A vehicle with no figure is unknown, never zero; a rate under its distance or engine floor says there is not enough; only rates of comparable vehicles are marked best. The period is in Saudi days, required and at most 366 days. Never a driver.\n\nRequires the key scope `reporting:reports_comparison:read`.",
                "summary": "Compare vehicles",
                "tags": [
                    "VehicleComparison"
                ],
                "parameters": [
                    {
                        "name": "vehicles[]",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "array",
                            "format": "uuid",
                            "items": {
                                "type": "string",
                                "format": "uuid"
                            }
                        }
                    },
                    {
                        "name": "from",
                        "in": "query",
                        "required": true,
                        "description": "Start of the period, ISO 8601 with an offset; its Saudi day is the first day.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "required": true,
                        "description": "End of the period, after from and at most 366 days later; its Saudi day is excluded.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The vehicles compared and one row per measure, a cell per vehicle; a vehicle with no data is unknown, never zero, and a total gets no verdict.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "period": {
                                                    "from": "2026-05-01",
                                                    "to": "2026-06-01"
                                                },
                                                "vehicles": [
                                                    {
                                                        "vehicle_uuid": "7c1d2e44-5b6a-4f0e-9a3b-1d2c3e4f5a66",
                                                        "plate": "ABC 1234",
                                                        "is_reference": true,
                                                        "is_comparable": true,
                                                        "warnings": []
                                                    }
                                                ],
                                                "rows": [
                                                    {
                                                        "key": "idle_share",
                                                        "currency": null,
                                                        "is_rate": true,
                                                        "better": "lower",
                                                        "group_average": 14.2,
                                                        "cells": [
                                                            {
                                                                "vehicle_uuid": "7c1d2e44-5b6a-4f0e-9a3b-1d2c3e4f5a66",
                                                                "state": "value",
                                                                "value": 12.5,
                                                                "is_best": true,
                                                                "change_percent": null,
                                                                "change_direction": null,
                                                                "change_verdict": null
                                                            }
                                                        ]
                                                    }
                                                ]
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "period": {
                                                            "type": "object",
                                                            "properties": {
                                                                "from": {
                                                                    "type": "string"
                                                                },
                                                                "to": {
                                                                    "type": "string"
                                                                }
                                                            },
                                                            "required": [
                                                                "from",
                                                                "to"
                                                            ]
                                                        },
                                                        "vehicles": {
                                                            "type": "array",
                                                            "items": []
                                                        },
                                                        "rows": {
                                                            "type": "array",
                                                            "items": []
                                                        }
                                                    },
                                                    "required": [
                                                        "period",
                                                        "vehicles",
                                                        "rows"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "type": "string"
                                                        },
                                                        "timestamp": {
                                                            "type": "string"
                                                        },
                                                        "timezone": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "timezone"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/vehicle-days": {
            "get": {
                "operationId": "vehicle_days.index",
                "description": "Lists, for each of your vehicles and each day on the platform calendar (Asia/Riyadh) from the day of from up to the day of to (excluded), the distance, the trips, how the time split between moving, idling with the engine on, parked and without signal, the top speed and the times of the first and last signal. Days are built overnight for the last closed days; a figure that was not recorded for a day is null, never zero. At most 31 days at a time, one page at a time, oldest day first. A branch-limited key sees only its own branch. A vehicle you sold or scrapped shows its days up to its sale day and none after it. Times are UTC; meta.timezone names the platform time zone.\n\nRequires the key scope `positions:read`.",
                "summary": "List vehicle days",
                "tags": [
                    "VehicleDay"
                ],
                "parameters": [
                    {
                        "name": "from",
                        "in": "query",
                        "required": true,
                        "description": "Start of the window, ISO 8601 with an offset (e.g. 2026-06-01T00:00:00Z); the platform day it falls in is included.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "required": true,
                        "description": "End of the window, after from and at most 31 days later; the platform day it falls in is excluded.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "vehicle",
                        "in": "query",
                        "description": "Only the days of this vehicle (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of vehicle days.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                    "day": "2026-06-01",
                                                    "distance_m": 184200,
                                                    "trip_count": 3,
                                                    "moving_seconds": 14400,
                                                    "idle_seconds": 1800,
                                                    "parked_seconds": 58800,
                                                    "no_signal_seconds": 3600,
                                                    "max_speed_kmh": 96,
                                                    "first_signal_at": "2026-06-01T02:10:00Z",
                                                    "last_signal_at": "2026-06-01T20:55:00Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": []
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "page": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "limit": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": "integer"
                                                                                },
                                                                                []
                                                                            ]
                                                                        },
                                                                        "next_cursor": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": [
                                                                                        "string",
                                                                                        "null"
                                                                                    ]
                                                                                },
                                                                                []
                                                                            ]
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "limit",
                                                                        "next_cursor"
                                                                    ],
                                                                    "additionalProperties": []
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timezone": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "page",
                                                        "timezone"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    },
                                                    "minItems": 0,
                                                    "maxItems": 0
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "page": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "limit": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": "integer"
                                                                                },
                                                                                []
                                                                            ]
                                                                        },
                                                                        "next_cursor": []
                                                                    },
                                                                    "required": [
                                                                        "limit",
                                                                        "next_cursor"
                                                                    ],
                                                                    "additionalProperties": []
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timezone": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "page",
                                                        "timezone"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/vehicles/{uuid}/documents": {
            "get": {
                "operationId": "vehicles.documents.index",
                "description": "Lists the files attached to one of your company's vehicles, newest first, up to 200: the document's uuid, its kind (vehicle_registration, vehicle_photo or other), where it came from, and whether it is the approved public photo of the vehicle. It gives the metadata only, never the file, its name or its title. A vehicle of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `vehicles:read`.",
                "summary": "List the files of a vehicle",
                "tags": [
                    "VehicleDocument"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "kind",
                        "in": "query",
                        "description": "Only the files of this kind; vehicle_photo lists the photos.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "vehicle_photo"
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The files of the vehicle.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "document_uuid": "1c9f4e82-7a35-4b60-8d12-5e3b0a7c9f46",
                                                    "kind": "vehicle_photo",
                                                    "origin": "person",
                                                    "is_public_photo": true,
                                                    "public_position": 1,
                                                    "created_at": "2026-04-19T11:00:00Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 200,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": [
                                                    "object",
                                                    "null"
                                                ],
                                                "properties": {
                                                    "document_uuid": {
                                                        "type": "string"
                                                    },
                                                    "kind": {
                                                        "type": "string"
                                                    },
                                                    "origin": {
                                                        "type": "string"
                                                    },
                                                    "is_public_photo": {
                                                        "type": "boolean"
                                                    },
                                                    "public_position": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ]
                                                    },
                                                    "created_at": {
                                                        "type": "string"
                                                    }
                                                },
                                                "required": [
                                                    "document_uuid",
                                                    "kind",
                                                    "origin",
                                                    "is_public_photo",
                                                    "public_position",
                                                    "created_at"
                                                ]
                                            }
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer",
                                                                            "const": 200
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": []
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "post": {
                "operationId": "vehicles.documents.store",
                "description": "Attaches a PDF, JPEG or PNG to one of your company's vehicles as a registration copy or another vehicle document, as the panel does. Other kinds, driver files, photos and sale contracts are refused. The file is scanned before it is stored and an infected file or a scanner outage is refused (422), so the answer carries the document in its `state`, `available`; there is nothing to poll. A company may upload a limited number of bytes a day, and a key a limited number of files an hour, through the API (429 with the reason `daily_quota` or `hourly_uploads`). Requires the key scope `fleet:documents:write`, its owner's right to attach documents, and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:documents:write`.",
                "summary": "Attach a document to a vehicle",
                "tags": [
                    "VehicleDocumentWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/UploadVehicleDocumentRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "file": {
                                                "type": "string",
                                                "format": "binary",
                                                "description": "The file, sent as multipart form data."
                                            },
                                            "kind": {
                                                "type": "string",
                                                "description": "vehicle_registration or other.",
                                                "examples": [
                                                    "vehicle_registration"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "file",
                                            "kind"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The attached document; state is available once the scan is clean, otherwise pending.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "5e8f1a22-3b4c-4d6e-8a9b-0c1d2e3f4a55",
                                                "kind": "vehicle_registration",
                                                "state": "available",
                                                "mime_type": "application/pdf",
                                                "size_bytes": 184320,
                                                "created_at": "2026-06-01T09:00:00Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uuid": {
                                                    "type": "string"
                                                },
                                                "kind": {
                                                    "type": "string"
                                                },
                                                "state": {
                                                    "type": "string",
                                                    "enum": [
                                                        "available",
                                                        "pending"
                                                    ]
                                                },
                                                "mime_type": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "size_bytes": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "uuid",
                                                "kind",
                                                "state",
                                                "mime_type",
                                                "size_bytes",
                                                "created_at"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/vehicles/{uuid}/facts": {
            "get": {
                "operationId": "vehicles.facts",
                "description": "Reads what other parts of the platform say about one of your company's vehicles by its uuid, for example that it is out on hire until a date. The read is closed (404) until your administration opens it in the settings; a vehicle of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `vehicles:read`.",
                "summary": "Read the facts of a vehicle",
                "tags": [
                    "VehicleFacts"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The facts.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "9f1c6a3e-6d1b-4f6e-8f55-0a1b2c3d4e5f",
                                                "hire": {
                                                    "on_hire": true,
                                                    "ends_at": "2026-12-01T07:00:00Z",
                                                    "reference": null
                                                }
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uuid": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "uuid"
                                            ],
                                            "additionalProperties": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "$ref": "#/components/responses/AuthorizationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/vehicles/{uuid}/now": {
            "get": {
                "operationId": "vehicles.now",
                "description": "Reads the last known position of one of your vehicles by its uuid, with its speed, whether its engine ran, the time of the fix (UTC) and the state of the trip it is on, if any. A vehicle with no position yet answers 200 with has_position false and null fields. A vehicle of another company, or out of your scope, answers 404 exactly like one that does not exist. A vehicle sold earlier shows nothing after its sale day.\n\nRequires the key scope `positions:read`.",
                "summary": "Read what a vehicle is doing now",
                "tags": [
                    "VehicleNow"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The vehicle now.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "has_position": true,
                                                "latitude": 24.7136,
                                                "longitude": 46.6753,
                                                "speed_kmh": 62,
                                                "ignition": true,
                                                "fix_at": "2026-06-01T09:00:00Z",
                                                "trip_state": "in_progress"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:05Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "has_position": {
                                                            "type": "boolean"
                                                        },
                                                        "latitude": {
                                                            "type": [
                                                                "number",
                                                                "null"
                                                            ]
                                                        },
                                                        "longitude": {
                                                            "type": [
                                                                "number",
                                                                "null"
                                                            ]
                                                        },
                                                        "speed_kmh": {
                                                            "type": [
                                                                "number",
                                                                "null"
                                                            ]
                                                        },
                                                        "ignition": {
                                                            "type": [
                                                                "boolean",
                                                                "null"
                                                            ]
                                                        },
                                                        "fix_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "trip_state": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "has_position",
                                                        "latitude",
                                                        "longitude",
                                                        "speed_kmh",
                                                        "ignition",
                                                        "fix_at",
                                                        "trip_state"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/vehicles/{uuid}/odometer-readings": {
            "get": {
                "operationId": "vehicles.odometer_readings.index",
                "description": "Lists the odometer readings of one of your company's vehicles, newest first, one page at a time: the reading's uuid, the kilometres, when it was read (UTC), its source (manual, fuel_log, service, handover or handover_device: the last two are claims made at a hand-over, a device number a person confirmed is never a measurement) and the note the vehicle page shows to the same person. A reading that was withdrawn is listed with withdrawn=true. A vehicle of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `vehicles:read`.",
                "summary": "List the odometer readings of a vehicle",
                "tags": [
                    "VehicleOdometerReading"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of odometer readings.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "1c9f4e82-7a35-4b60-8d12-5e3b0a7c9f46",
                                                    "km": 125430.5,
                                                    "read_at": "2026-06-01T08:00:00Z",
                                                    "source": "manual",
                                                    "note": null,
                                                    "withdrawn": false
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "string"
                                            }
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "$ref": "#/components/responses/AuthorizationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "post": {
                "operationId": "vehicles.odometer_readings.store",
                "description": "Records a manual odometer reading of one of your company's vehicles, as the vehicle page does: not below an earlier reading, not above a later one, not in the future. The source is always manual. A reading cannot be withdrawn with a key. At most 12 readings an hour for one vehicle. A vehicle of another company or branch answers 404 exactly like one that does not exist. Requires the key scope `fleet:odometer:write`.\n\nRequires the key scope `fleet:odometer:write`.",
                "summary": "Record an odometer reading",
                "tags": [
                    "VehicleOdometerReadingWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/RecordOdometerReadingRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "km": {
                                                "type": "object",
                                                "description": "The odometer in kilometres, up to one decimal; Arabic digits are accepted.",
                                                "examples": [
                                                    125430.5
                                                ]
                                            },
                                            "read_at": {
                                                "type": "string",
                                                "format": "date-time",
                                                "description": "When it was read, ISO 8601 with an offset.",
                                                "examples": [
                                                    "2026-06-01T08:00:00+03:00"
                                                ]
                                            },
                                            "note": {
                                                "type": "string",
                                                "description": "An optional plain note of at most 300 characters.",
                                                "examples": [
                                                    "Read at the yard"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "km",
                                            "read_at"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The reading that was recorded.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "1c9f4e82-7a35-4b60-8d12-5e3b0a7c9f46",
                                                "km": 125430.5,
                                                "read_at": "2026-06-01T05:00:00Z",
                                                "source": "manual",
                                                "note": null,
                                                "withdrawn": false
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uuid": {
                                                    "type": "string"
                                                },
                                                "km": {
                                                    "type": "number"
                                                },
                                                "read_at": {
                                                    "type": "string"
                                                },
                                                "source": {
                                                    "type": "string"
                                                },
                                                "note": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "withdrawn": {
                                                    "type": "boolean"
                                                }
                                            },
                                            "required": [
                                                "uuid",
                                                "km",
                                                "read_at",
                                                "source",
                                                "note",
                                                "withdrawn"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/vehicles/{uuid}/overview": {
            "get": {
                "operationId": "vehicles.overview",
                "description": "This month's figures of one of your vehicles against last month, and what ends soon on it (inspection, maintenance, warranty, lease, registration, insurance, operation card, inspection certificate): a label, a day and the days left. It never carries a position, a driver's name, a document number or the vehicle's activity. Another company's or branch's vehicle is a 404.\n\nRequires the key scope `fleet:overview:read`.",
                "summary": "Read a vehicle's overview",
                "tags": [
                    "VehicleOverview"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The overview.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "tiles": [
                                                    {
                                                        "label": "Distance",
                                                        "value": "1,240 km",
                                                        "change": "+8%",
                                                        "sentence": "Against last month"
                                                    }
                                                ],
                                                "expiring": [
                                                    {
                                                        "label": "Registration",
                                                        "detail": "Ends 2026-12-20",
                                                        "days": 36
                                                    }
                                                ]
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-14T10:00:00+00:00"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "tiles": {
                                                            "type": "array",
                                                            "items": []
                                                        },
                                                        "expiring": {
                                                            "type": "array",
                                                            "items": []
                                                        }
                                                    },
                                                    "required": [
                                                        "tiles",
                                                        "expiring"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "type": "string"
                                                        },
                                                        "timestamp": {
                                                            "type": "string"
                                                        },
                                                        "timezone": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "timezone"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/vehicles/{uuid}/photos": {
            "get": {
                "operationId": "vehicles.photos.index",
                "description": "Lists the photos of one of your company's vehicles, at most 50: the photo's id, whether it is approved for the public market, and its place among the approved ones. No file, link or name is returned and no route reads the file by this id with a key. Requires the key scope `fleet:vehicle_photos:read`.\n\nRequires the key scope `fleet:vehicle_photos:read`.",
                "summary": "List the photos of a vehicle",
                "tags": [
                    "VehiclePhotoList"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The photos of the vehicle.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "id": "5c1e0b7a-4f2d-4a8e-9b63-0d2f7a9c1e55",
                                                    "state": "approved",
                                                    "position": 1
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": []
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/vehicles/{uuid}/photo/thumbnail": {
            "get": {
                "operationId": "vehicles.photo.thumbnail",
                "description": "Returns the main photo of one of your company's vehicles as a small jpeg: the first approved photo, else the first added. The optional `width` is 160, 320 (default) or 640 pixels for the longer side. Only this reduced copy is served, never the original file. Requires the key scope `fleet:vehicle_photos:read`.\n\nRequires the key scope `fleet:vehicle_photos:read`.",
                "summary": "Get the main photo of a vehicle as a thumbnail",
                "tags": [
                    "VehiclePhotoThumbnail"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The thumbnail, image/jpeg.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": [
                                        "string",
                                        "object"
                                    ]
                                }
                            },
                            "image/jpeg": {
                                "schema": {
                                    "type": "string",
                                    "format": "binary"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/reports/vehicle-profit": {
            "get": {
                "operationId": "reports.vehicle_profit",
                "description": "Lists, for each of your vehicles, what it earned and cost in the period: delivered and unpriced orders, revenue, fuel, maintenance, expenses, the daily allowance of its drivers, the margin, its percent of the earnings and the distance. Money is a list of lines, one per currency, never added across currencies. Other income, roadside help and depreciation appear only for a key whose owner may also see them, and so do the net profit after lease, depreciation, roadside help and insurance and its percent. The period is whole Saudi days, at most a year; no driver is named.\n\nRequires the key scope `reporting:reports_vehicle_profit:read`.",
                "summary": "Read the vehicle profitability report",
                "tags": [
                    "VehicleProfitReport"
                ],
                "parameters": [
                    {
                        "name": "from",
                        "in": "query",
                        "required": true,
                        "description": "Start of the period, ISO 8601 with an offset.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "required": true,
                        "description": "End of the period, after from and at most 366 days later; its Saudi day is included.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "vehicle",
                        "in": "query",
                        "description": "Only this vehicle (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "One page of vehicles; a figure the key owner may not see is absent.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "vehicle_uuid": "7c1d2e44-5b6a-4f0e-9a3b-1d2c3e4f5a6b",
                                                    "plate": "ABC 1234",
                                                    "delivered_orders": 12,
                                                    "unpriced_orders": 0,
                                                    "distance_km": 4210.5,
                                                    "revenue": [
                                                        {
                                                            "currency": "SAR",
                                                            "amount": "36000.00"
                                                        }
                                                    ],
                                                    "fuel": [
                                                        {
                                                            "currency": "SAR",
                                                            "amount": "9100.00"
                                                        }
                                                    ],
                                                    "maintenance": [],
                                                    "expenses": [
                                                        {
                                                            "currency": "SAR",
                                                            "amount": "800.00"
                                                        }
                                                    ],
                                                    "per_diem": {
                                                        "amounts": [
                                                            {
                                                                "currency": "SAR",
                                                                "amount": "1200.00"
                                                            }
                                                        ],
                                                        "days_without_rate": 0
                                                    },
                                                    "lease": [],
                                                    "margin": [
                                                        {
                                                            "currency": "SAR",
                                                            "amount": "24900.00"
                                                        }
                                                    ],
                                                    "margin_percent": [
                                                        {
                                                            "currency": "SAR",
                                                            "percent": "69.2"
                                                        }
                                                    ]
                                                }
                                            ],
                                            "meta": {
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": []
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "page": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "limit": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": "integer"
                                                                                },
                                                                                []
                                                                            ]
                                                                        },
                                                                        "next_cursor": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": [
                                                                                        "string",
                                                                                        "null"
                                                                                    ]
                                                                                },
                                                                                []
                                                                            ]
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "limit",
                                                                        "next_cursor"
                                                                    ],
                                                                    "additionalProperties": []
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timezone": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "page",
                                                        "timezone"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    },
                                                    "minItems": 0,
                                                    "maxItems": 0
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "page": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "limit": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": "integer"
                                                                                },
                                                                                []
                                                                            ]
                                                                        },
                                                                        "next_cursor": []
                                                                    },
                                                                    "required": [
                                                                        "limit",
                                                                        "next_cursor"
                                                                    ],
                                                                    "additionalProperties": []
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timezone": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "page",
                                                        "timezone"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/vehicles/{uuid}/archive": {
            "post": {
                "operationId": "vehicles.archive",
                "description": "Archives one of your company's vehicles, as the panel does: it leaves the active lists and cannot be put back by a key. A vehicle that still has an open driver assignment, a device installed, a trip in progress or a live booking on the transport market, or is already archived, answers 422. Send `confirm` set to true. A vehicle of another company or branch answers 404 exactly like one that does not exist. Requires the key scope `fleet:vehicles:register`, its owner's right to archive vehicles, and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:vehicles:register`.",
                "summary": "Archive a vehicle",
                "tags": [
                    "VehicleRegister"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/ArchiveVehicleRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "confirm": {
                                                "type": "boolean",
                                                "description": "Must be true: archiving takes the vehicle out of work.",
                                                "examples": [
                                                    true
                                                ]
                                            }
                                        },
                                        "required": [
                                            "confirm"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The vehicle that was archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "archived": true
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "archived": {
                                                            "type": "boolean"
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "archived"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/video/clips": {
            "post": {
                "operationId": "video.clips",
                "description": "Stores the video clip or the still picture of a camera event you already sent to /video/events. Send multipart/form-data with the event_id of that event, kind (clip or snapshot), captured_at (ISO 8601 with a zone, within ten minutes of the event), optionally camera_channel (1 to 8, default 1) and duration_seconds (clips only, 1 to 300), and the file: an MP4 for a clip, a JPEG or PNG for a snapshot. The file is recognised by its content, scanned and stored encrypted; it is kept for the company's retention period from its capture and then deleted for good. One event holds one clip and one snapshot per camera channel: sending the same bytes again answers 200 with the stored clip, other bytes answer 409 idempotency_conflict. A refusal stores nothing: 403 forbidden when the company has not enabled video, the plan does not include it or the month's clips are used; 413 payload_too_large; 422 validation_failed with a detail per field, an unknown event, a file that is not what its kind says or is infected, or a clip that would be deleted within the hour; 503 service_unavailable while the scanner or the storage cannot answer, so send it again later.",
                "summary": "Send a camera clip or snapshot",
                "tags": [
                    "VideoClipUpload"
                ],
                "parameters": [
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "event_id": {
                                        "type": "string",
                                        "description": "The id you gave the event when you sent it.",
                                        "examples": [
                                            "evt-2026-11-07-0001"
                                        ]
                                    },
                                    "kind": {
                                        "type": "string",
                                        "description": "clip (an MP4) or snapshot (a JPEG or PNG).",
                                        "examples": [
                                            "clip"
                                        ]
                                    },
                                    "captured_at": {
                                        "type": "string",
                                        "description": "When the footage starts, ISO 8601 with a zone.",
                                        "examples": [
                                            "2026-11-07T08:15:20Z"
                                        ]
                                    },
                                    "file": {
                                        "type": "string",
                                        "format": "binary",
                                        "description": "The file itself."
                                    }
                                },
                                "required": [
                                    "event_id",
                                    "kind",
                                    "captured_at",
                                    "file"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The same clip was already stored; nothing new is written.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "clip_id": "0198a3c2-7e1d-7a40-9c11-2f0c5d6b8a10",
                                                "kind": "clip",
                                                "status": "available",
                                                "bytes": 4850231,
                                                "retention_until": "2026-12-07T08:15:20Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "7f3c9a1e-2b4d-4c8e-9f10-000000000000",
                                                "timestamp": "2026-11-07T08:20:00Z"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "201": {
                        "description": "The clip is stored.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "clip_id": "0198a3c2-7e1d-7a40-9c11-2f0c5d6b8a10",
                                                "kind": "clip",
                                                "status": "available",
                                                "bytes": 4850231,
                                                "retention_until": "2026-12-07T08:15:20Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "7f3c9a1e-2b4d-4c8e-9f10-000000000000",
                                                "timestamp": "2026-11-07T08:16:00Z"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the source token is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string",
                                    "examples": [
                                        {
                                            "success": false,
                                            "data": null,
                                            "error": {
                                                "code": "unauthenticated",
                                                "message": "Authentication is required."
                                            },
                                            "meta": {
                                                "request_id": "7f3c9a1e-2b4d-4c8e-9f10-000000000000",
                                                "timestamp": "2026-11-07T08:16:00Z"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "idempotency_conflict: this event already holds other bytes in that slot.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string",
                                    "examples": [
                                        {
                                            "success": false,
                                            "data": null,
                                            "error": {
                                                "code": "idempotency_conflict",
                                                "message": "The idempotency key was already used with a different body."
                                            },
                                            "meta": {
                                                "request_id": "7f3c9a1e-2b4d-4c8e-9f10-000000000000",
                                                "timestamp": "2026-11-07T08:16:00Z"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: one detail per invalid field, or a refused file.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string",
                                    "examples": [
                                        {
                                            "success": false,
                                            "data": null,
                                            "error": {
                                                "code": "validation_failed",
                                                "message": "The request contains invalid fields.",
                                                "details": [
                                                    {
                                                        "field": "file",
                                                        "code": "invalid_format",
                                                        "message": "This value has an invalid format."
                                                    }
                                                ]
                                            },
                                            "meta": {
                                                "request_id": "7f3c9a1e-2b4d-4c8e-9f10-000000000000",
                                                "timestamp": "2026-11-07T08:16:00Z"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/violations": {
            "get": {
                "operationId": "violations.index",
                "description": "Lists your company's traffic violations, oldest first, one page of at most 50. Every call is recorded in the violations read log with the number of rows and the key; if it cannot be recorded nothing is returned (503). A day's rows are capped per key and per company (429). The driver, the ticket file and who recorded a violation are never shown.\n\nRequires the key scope `fleet:violations:read`.",
                "summary": "List violations",
                "tags": [
                    "Violation"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only violations in this state: new, objected, objection_accepted, objection_rejected, paid or cancelled.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "new"
                    },
                    {
                        "name": "vehicle",
                        "in": "query",
                        "description": "Only the violations of this vehicle (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only violations changed at or after this moment (ISO 8601 with an offset).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "One page of violations, oldest first; next_cursor is null on the last page.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "3c9a1d7e-5b24-4e80-9f61-7d2a0c8b4e15",
                                                    "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                    "authority": "traffic",
                                                    "type_code": "speeding",
                                                    "number": "4100236571",
                                                    "occurred_at": "2026-05-12T08:30:00Z",
                                                    "place": "Riyadh, King Fahd Road",
                                                    "amount_minor": 30000,
                                                    "currency": "SAR",
                                                    "due_on": "2026-06-12",
                                                    "status": "new",
                                                    "paid_on": null,
                                                    "created_at": "2026-05-12T12:00:00Z",
                                                    "updated_at": "2026-05-12T12:00:00Z",
                                                    "row_version": 1
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "type": [
                                        "object",
                                        "string"
                                    ]
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "post": {
                "operationId": "violations.record",
                "description": "Records a violation on one of your company's vehicles, as the panel does: its number, who issued it, its type, when it happened (Saudi time, not in the future), the amount and the optional due day. The company's rules apply exactly as in the panel. A driver, a place, a ticket file and a receipt cannot be sent. Send an Idempotency-Key header so a retry does not record it twice. Requires the key scope `fleet:violations:write`.\n\nRequires the key scope `fleet:violations:write`.",
                "summary": "Record a traffic violation",
                "tags": [
                    "ViolationWrite"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/RecordViolationRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "vehicle": {
                                                "type": "string",
                                                "format": "uuid",
                                                "description": "The vehicle, by its uuid.",
                                                "examples": [
                                                    "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11"
                                                ]
                                            },
                                            "number": {
                                                "type": "string",
                                                "description": "The violation number on the notice.",
                                                "examples": [
                                                    "12345678"
                                                ]
                                            },
                                            "authority": {
                                                "type": "string",
                                                "description": "traffic, transport_authority, municipality or other.",
                                                "examples": [
                                                    "traffic"
                                                ]
                                            },
                                            "type": {
                                                "type": "string",
                                                "description": "The code of an active violation type.",
                                                "examples": [
                                                    "speeding"
                                                ]
                                            },
                                            "occurred_at": {
                                                "type": "string",
                                                "description": "When it happened, Y-m-d H:i in Saudi time.",
                                                "examples": [
                                                    "2026-11-01 08:30"
                                                ]
                                            },
                                            "amount": {
                                                "type": "string",
                                                "description": "The fine as a decimal in the currency.",
                                                "examples": [
                                                    "300.00"
                                                ]
                                            },
                                            "currency": {
                                                "type": "string",
                                                "description": "A three-letter code the company has enabled; the company's default when left out.",
                                                "examples": [
                                                    "SAR"
                                                ]
                                            },
                                            "due_on": {
                                                "type": "string",
                                                "format": "date",
                                                "description": "The last day to pay, Y-m-d; not before the day of the violation.",
                                                "examples": [
                                                    "2026-12-01"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "vehicle",
                                            "number",
                                            "authority",
                                            "type",
                                            "occurred_at",
                                            "amount"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The violation that was recorded, with its version.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "status": "new",
                                                "row_version": 1
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uuid": {
                                                    "type": "string"
                                                },
                                                "status": {
                                                    "type": "string"
                                                },
                                                "row_version": {
                                                    "type": "integer"
                                                }
                                            },
                                            "required": [
                                                "uuid",
                                                "status",
                                                "row_version"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/violations/{uuid}": {
            "get": {
                "operationId": "violations.show",
                "description": "Reads one of your company's traffic violations by its uuid; the read is recorded in the violations read log and counts one row of the day's budget. A record of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `fleet:violations:read`.",
                "summary": "Read a violation",
                "tags": [
                    "Violation"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The violation.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "3c9a1d7e-5b24-4e80-9f61-7d2a0c8b4e15",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "authority": "traffic",
                                                "type_code": "speeding",
                                                "number": "4100236571",
                                                "occurred_at": "2026-05-12T08:30:00Z",
                                                "place": "Riyadh, King Fahd Road",
                                                "amount_minor": 30000,
                                                "currency": "SAR",
                                                "due_on": "2026-06-12",
                                                "status": "new",
                                                "paid_on": null,
                                                "created_at": "2026-05-12T12:00:00Z",
                                                "updated_at": "2026-05-12T12:00:00Z",
                                                "row_version": 1
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "type": [
                                        "object",
                                        "string"
                                    ]
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "put": {
                "operationId": "violations.update",
                "description": "Corrects the number, issuer, type, time, amount or due day of a violation that has not been paid or cancelled, as the panel does. Send the `row_version` you read: a violation changed meanwhile answers 409. The driver stays as it is. Requires the key scope `fleet:violations:write`.\n\nRequires the key scope `fleet:violations:write`.",
                "summary": "Correct a traffic violation",
                "tags": [
                    "ViolationWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/UpdateViolationRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The version of the violation you read.",
                                                "examples": [
                                                    1
                                                ]
                                            },
                                            "number": {
                                                "type": "string",
                                                "description": "The violation number on the notice.",
                                                "examples": [
                                                    "12345678"
                                                ]
                                            },
                                            "authority": {
                                                "type": "string",
                                                "description": "traffic, transport_authority, municipality or other.",
                                                "examples": [
                                                    "traffic"
                                                ]
                                            },
                                            "type": {
                                                "type": "string",
                                                "description": "The code of an active violation type.",
                                                "examples": [
                                                    "speeding"
                                                ]
                                            },
                                            "occurred_at": {
                                                "type": "string",
                                                "description": "When it happened, Y-m-d H:i in Saudi time.",
                                                "examples": [
                                                    "2026-11-01 08:30"
                                                ]
                                            },
                                            "amount": {
                                                "type": "string",
                                                "description": "The fine as a decimal in the currency.",
                                                "examples": [
                                                    "300.00"
                                                ]
                                            },
                                            "currency": {
                                                "type": "string",
                                                "description": "A three-letter code the company has enabled.",
                                                "examples": [
                                                    "SAR"
                                                ]
                                            },
                                            "due_on": {
                                                "type": "string",
                                                "format": "date",
                                                "description": "The last day to pay, Y-m-d.",
                                                "examples": [
                                                    "2026-12-01"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version",
                                            "number",
                                            "authority",
                                            "type",
                                            "occurred_at",
                                            "amount"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The violation, corrected.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "status": "new",
                                                "row_version": 2
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "row_version": {
                                                            "type": "integer"
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "status",
                                                        "row_version"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/violations/{uuid}/pay": {
            "post": {
                "operationId": "violations.pay",
                "description": "Marks a violation still owed as paid, as the panel does: paid by the company it becomes one fines expense, paid by the driver it makes none. A different amount needs a `difference_note`. A receipt file cannot be sent here: when your company requires one for the amount the answer is 422 with reason `receipt_required` and the payment is made in the panel. A stale `row_version` or a violation not owed gives 409. Requires the key scope `fleet:violation_payments:write`, an owner who may settle violations and did not record this one, and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:violation_payments:write`.",
                "summary": "Mark a violation paid",
                "tags": [
                    "ViolationPayment"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/PayViolationRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The row_version of the violation you read.",
                                                "examples": [
                                                    1
                                                ]
                                            },
                                            "paid_on": {
                                                "type": "string",
                                                "format": "date",
                                                "description": "The day paid, Saudi calendar, not before the offence and not in the future.",
                                                "examples": [
                                                    "2026-11-17"
                                                ]
                                            },
                                            "amount": {
                                                "type": "string",
                                                "description": "The amount paid in the violation's currency, as a decimal.",
                                                "examples": [
                                                    "300.000"
                                                ]
                                            },
                                            "paid_by": {
                                                "type": "string",
                                                "description": "company or driver.",
                                                "examples": [
                                                    "company"
                                                ]
                                            },
                                            "difference_note": {
                                                "type": "string",
                                                "description": "Why the amount differs from the violation's own, 3 to 300 characters."
                                            }
                                        },
                                        "required": [
                                            "row_version",
                                            "paid_on",
                                            "amount",
                                            "paid_by"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The violation, now paid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "3c9a1d7e-5b24-4e80-9f61-7d2a0c8b4e15",
                                                "status": "paid",
                                                "paid_on": "2026-11-17",
                                                "row_version": 2
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-11-17T09:00:00Z"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "paid_on": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "row_version": {
                                                            "type": "integer"
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "status",
                                                        "paid_on",
                                                        "row_version"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/violations/{uuid}/reopen-payment": {
            "post": {
                "operationId": "violations.reopen_payment",
                "description": "Reopens a violation that was marked paid by mistake, with a reason, as the panel does: the fines expense that payment made is voided, an expense that was only linked stays, and the violation is owed again. Send the `row_version` you read: a violation changed meanwhile answers 409. The panel's own rule decides who may reopen. Requires the key scope `fleet:violation_payments:write`.\n\nRequires the key scope `fleet:violation_payments:write`.",
                "summary": "Reopen the payment of a violation",
                "tags": [
                    "ViolationPayment"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/ReopenViolationPaymentRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The row_version of the violation you read.",
                                                "examples": [
                                                    2
                                                ]
                                            },
                                            "reason": {
                                                "type": "string",
                                                "description": "Why the payment is reopened, plain text.",
                                                "examples": [
                                                    "Marked paid against the wrong violation"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version",
                                            "reason"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The violation, owed again.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "3c9a1d7e-5b24-4e80-9f61-7d2a0c8b4e15",
                                                "status": "new",
                                                "paid_on": null,
                                                "row_version": 3
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "paid_on": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "row_version": {
                                                            "type": "integer"
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "status",
                                                        "paid_on",
                                                        "row_version"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/violations/{uuid}/cancel": {
            "post": {
                "operationId": "violations.cancel",
                "description": "Cancels a violation with a reason; the row stays, shown as cancelled. Send the `row_version` you read: a violation changed meanwhile answers 409. Requires the key scope `fleet:violations:write`.\n\nRequires the key scope `fleet:violations:write`.",
                "summary": "Cancel a traffic violation",
                "tags": [
                    "ViolationWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/CancelViolationRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The version of the violation you read.",
                                                "examples": [
                                                    1
                                                ]
                                            },
                                            "reason": {
                                                "type": "string",
                                                "description": "Why it is cancelled, plain text.",
                                                "examples": [
                                                    "Recorded against the wrong vehicle"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version",
                                            "reason"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The violation, now cancelled.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "status": "cancelled",
                                                "row_version": 2
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "row_version": {
                                                            "type": "integer"
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "status",
                                                        "row_version"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/violations/{uuid}/object": {
            "post": {
                "operationId": "violations.object",
                "description": "Records that the company objected to a violation, with the day it was lodged and why, as the panel does. Send the `row_version` you read. Requires the key scope `fleet:violations:write`.\n\nRequires the key scope `fleet:violations:write`.",
                "summary": "Record an objection to a traffic violation",
                "tags": [
                    "ViolationWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/ObjectViolationRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The version of the violation you read.",
                                                "examples": [
                                                    1
                                                ]
                                            },
                                            "day": {
                                                "type": "string",
                                                "format": "date",
                                                "description": "The day the objection was lodged, Y-m-d.",
                                                "examples": [
                                                    "2026-11-10"
                                                ]
                                            },
                                            "reason": {
                                                "type": "string",
                                                "description": "Why the company objects, plain text.",
                                                "examples": [
                                                    "The vehicle was elsewhere at that time"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version",
                                            "day",
                                            "reason"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The violation, now objected to.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "status": "objected",
                                                "row_version": 2
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "row_version": {
                                                            "type": "integer"
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "status",
                                                        "row_version"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/violations/{uuid}/objection-outcome": {
            "post": {
                "operationId": "violations.objection_outcome",
                "description": "Records the authority's answer to an objection: accepted (nothing is owed) or rejected (owed again), with the day of the answer and an optional note, as the panel does. Send the `row_version` you read. Requires the key scope `fleet:violations:write`.\n\nRequires the key scope `fleet:violations:write`.",
                "summary": "Record the answer to an objection",
                "tags": [
                    "ViolationWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/ViolationObjectionOutcomeRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The version of the violation you read.",
                                                "examples": [
                                                    2
                                                ]
                                            },
                                            "accepted": {
                                                "type": "boolean",
                                                "description": "true when the authority accepted the objection.",
                                                "examples": [
                                                    true
                                                ]
                                            },
                                            "day": {
                                                "type": "string",
                                                "format": "date",
                                                "description": "The day of the answer, Y-m-d.",
                                                "examples": [
                                                    "2026-11-20"
                                                ]
                                            },
                                            "note": {
                                                "type": "string",
                                                "description": "An optional plain note.",
                                                "examples": [
                                                    "Answered by letter"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version",
                                            "accepted",
                                            "day"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The violation with its new state.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "status": "objection_accepted",
                                                "row_version": 3
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "row_version": {
                                                            "type": "integer"
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "status",
                                                        "row_version"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/webhook-deliveries": {
            "get": {
                "operationId": "webhook_deliveries.index",
                "description": "Lists the events sent, or waiting to be sent, to your company's webhook addresses, one page at a time, oldest first, with how each fared: its state, how many tries it took, the last HTTP status or failure code and when it was delivered. It never shows what the event carried. A delivery is kept for the retention period (30 days unless the platform sets another) and then disappears. Times are UTC.\n\nRequires the key scope `platform:webhooks:manage`.",
                "summary": "List webhook deliveries",
                "tags": [
                    "WebhookDelivery"
                ],
                "parameters": [
                    {
                        "name": "endpoint",
                        "in": "query",
                        "description": "Only deliveries to this webhook address (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only deliveries in this state: queued, sending, delivered or abandoned.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "abandoned"
                    },
                    {
                        "name": "event_type",
                        "in": "query",
                        "description": "Only deliveries of this event type, e.g. trip.status_changed.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "trip.status_changed"
                    },
                    {
                        "name": "created_since",
                        "in": "query",
                        "description": "Only deliveries of events from this moment on (ISO 8601 with an offset, e.g. 2026-05-01T00:00:00Z).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of webhook deliveries.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "8b2e6f40-1c93-4d57-a0e8-6f3b9c1d2a75",
                                                    "endpoint_uuid": "3f1c8a52-7d4e-4b9a-8c26-5e0d1a9b7c34",
                                                    "event_type": "trip.status_changed",
                                                    "status": "delivered",
                                                    "attempt_count": 2,
                                                    "created_at": "2026-06-01T07:40:00Z",
                                                    "next_attempt_at": "2026-06-01T07:40:00Z",
                                                    "delivered_at": "2026-06-01T07:41:12Z",
                                                    "last_http_status": 200,
                                                    "last_failure_code": null
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/webhook-deliveries/{uuid}": {
            "get": {
                "operationId": "webhook_deliveries.show",
                "description": "Reads one delivery by its own uuid with each try made at it: when it started, how long it took, and the HTTP status or the failure code. It never shows what the event carried or what your server answered. A delivery of another company, of an address the Tawasul team made, one past its retention period, or one that does not exist answers 404 in the same way. Times are UTC.\n\nRequires the key scope `platform:webhooks:manage`.",
                "summary": "Read a webhook delivery",
                "tags": [
                    "WebhookDelivery"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The webhook delivery with its tries.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "8b2e6f40-1c93-4d57-a0e8-6f3b9c1d2a75",
                                                "endpoint_uuid": "3f1c8a52-7d4e-4b9a-8c26-5e0d1a9b7c34",
                                                "event_type": "trip.status_changed",
                                                "status": "delivered",
                                                "attempt_count": 2,
                                                "created_at": "2026-06-01T07:40:00Z",
                                                "next_attempt_at": "2026-06-01T07:40:00Z",
                                                "delivered_at": "2026-06-01T07:41:12Z",
                                                "last_http_status": 200,
                                                "last_failure_code": null,
                                                "attempt_log": [
                                                    {
                                                        "attempt_no": 1,
                                                        "started_at": "2026-06-01T07:40:01Z",
                                                        "duration_ms": 840,
                                                        "http_status": 502,
                                                        "failure_code": "http_502"
                                                    },
                                                    {
                                                        "attempt_no": 2,
                                                        "started_at": "2026-06-01T07:41:11Z",
                                                        "duration_ms": 215,
                                                        "http_status": 200,
                                                        "failure_code": null
                                                    }
                                                ]
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "additionalProperties": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/webhook-deliveries/{uuid}/replay": {
            "post": {
                "operationId": "webhook_deliveries.replay",
                "description": "Sends a delivered or given-up delivery again to the same webhook address as a new delivery, queued at once and signed with the address's current secret. The receiver sees a new delivery id in X-Twi-Delivery and the original's in X-Twi-Replay-Of, so it can tell the repeat from the first send. The body is the original event as it was kept. Only a delivered or abandoned delivery of an active address can be replayed (409 with reason not_finished or endpoint_not_active); a delivery older than 30 days cannot be replayed (replay_expired); a test delivery or a replay cannot (not_replayable); one delivery can be replayed 3 times (replay_limit) and one address takes 20 replays an hour (429). Replay the original, not a replay. The Idempotency-Key header is required.\n\nRequires the key scope `platform:webhooks:manage`.",
                "summary": "Replay a webhook delivery",
                "tags": [
                    "WebhookDeliveryAction"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/WebhookActionRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "reason": {
                                                "type": "string",
                                                "description": "Why you replay it, kept in your company's audit trail only (3 to 200 characters).",
                                                "examples": [
                                                    "Receiver was down for the first send"
                                                ]
                                            }
                                        }
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The new delivery, queued, with no tries yet.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "8b2e6f40-1c93-4d57-a0e8-6f3b9c1d2a75",
                                                "endpoint_uuid": "3f1c8a52-7d4e-4b9a-8c26-5e0d1a9b7c34",
                                                "event_type": "trip.status_changed",
                                                "status": "delivered",
                                                "attempt_count": 2,
                                                "created_at": "2026-06-01T07:40:00Z",
                                                "next_attempt_at": "2026-06-01T07:40:00Z",
                                                "delivered_at": "2026-06-01T07:41:12Z",
                                                "last_http_status": 200,
                                                "last_failure_code": null,
                                                "attempt_log": [
                                                    {
                                                        "attempt_no": 1,
                                                        "started_at": "2026-06-01T07:40:01Z",
                                                        "duration_ms": 840,
                                                        "http_status": 502,
                                                        "failure_code": "http_502"
                                                    },
                                                    {
                                                        "attempt_no": 2,
                                                        "started_at": "2026-06-01T07:41:11Z",
                                                        "duration_ms": 215,
                                                        "http_status": 200,
                                                        "failure_code": null
                                                    }
                                                ]
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uuid": {
                                                    "type": "string"
                                                },
                                                "endpoint_uuid": {
                                                    "type": "string"
                                                },
                                                "event_type": {
                                                    "type": "string"
                                                },
                                                "status": {
                                                    "type": "string"
                                                },
                                                "attempt_count": {
                                                    "type": "string"
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "next_attempt_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "delivered_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "last_http_status": {
                                                    "type": "string"
                                                },
                                                "last_failure_code": {
                                                    "type": "string"
                                                },
                                                "attempt_log": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "uuid",
                                                "endpoint_uuid",
                                                "event_type",
                                                "status",
                                                "attempt_count",
                                                "created_at",
                                                "next_attempt_at",
                                                "delivered_at",
                                                "last_http_status",
                                                "last_failure_code",
                                                "attempt_log"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/webhook-endpoints": {
            "get": {
                "operationId": "webhook_endpoints.index",
                "description": "Lists the webhook addresses your company added in the portal, one page at a time, oldest first. Each shows its name, where it points (the address with its query string, and any long token-like part of its path, replaced by ***), the events it listens to, whether it is pending, active, paused or disabled, why it is paused, and when it last succeeded or failed. It never shows a signing secret. Addresses the Tawasul team made for your company are not listed. Times are UTC; meta.timezone names the platform time zone.\n\nRequires the key scope `platform:webhooks:manage`.",
                "summary": "List webhook addresses",
                "tags": [
                    "WebhookEndpoint"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only addresses in this state: pending, active, paused or disabled.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "paused"
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only addresses changed at or after this moment (ISO 8601 with an offset, e.g. 2026-05-01T00:00:00Z).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of webhook addresses.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "3f1c8a52-7d4e-4b9a-8c26-5e0d1a9b7c34",
                                                    "name": "Fleet feed",
                                                    "url": "https://hooks.example.com/twi/events?***",
                                                    "events": [
                                                        "trip.status_changed",
                                                        "alert.opened"
                                                    ],
                                                    "status": "paused",
                                                    "paused_reason": "manual",
                                                    "paused_at": "2026-06-01T07:42:10Z",
                                                    "consecutive_failures": 0,
                                                    "last_success_at": "2026-05-31T22:10:03Z",
                                                    "last_failure_at": null,
                                                    "approved_at": "2026-05-20T09:00:00Z",
                                                    "updated_at": "2026-06-01T07:42:10Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/webhook-endpoints/{uuid}": {
            "get": {
                "operationId": "webhook_endpoints.show",
                "description": "Reads one of your company's webhook addresses by its own uuid. An address of another company, one the Tawasul team made, or one that does not exist answers 404 in the same way. Times are UTC.\n\nRequires the key scope `platform:webhooks:manage`.",
                "summary": "Read a webhook address",
                "tags": [
                    "WebhookEndpoint"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The webhook address.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "3f1c8a52-7d4e-4b9a-8c26-5e0d1a9b7c34",
                                                "name": "Fleet feed",
                                                "url": "https://hooks.example.com/twi/events?***",
                                                "events": [
                                                    "trip.status_changed",
                                                    "alert.opened"
                                                ],
                                                "status": "paused",
                                                "paused_reason": "manual",
                                                "paused_at": "2026-06-01T07:42:10Z",
                                                "consecutive_failures": 0,
                                                "last_success_at": "2026-05-31T22:10:03Z",
                                                "last_failure_at": null,
                                                "approved_at": "2026-05-20T09:00:00Z",
                                                "updated_at": "2026-06-01T07:42:10Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "additionalProperties": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/webhook-endpoints/{uuid}/pause": {
            "post": {
                "operationId": "webhook_endpoints.pause",
                "description": "Stops sending events to one of your company's active webhook addresses; the events that happen meanwhile wait in the queue. Only an active address can be paused: any other state answers 409 with reason not_active. The company's admins are told that a key did it. Resume it with the resume call. The Idempotency-Key header is required, so a repeated call is safe.\n\nRequires the key scope `platform:webhooks:manage`.",
                "summary": "Pause a webhook address",
                "tags": [
                    "WebhookEndpointAction"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/WebhookActionRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "reason": {
                                                "type": "string",
                                                "description": "Why you pause it, kept in your company's audit trail only (3 to 200 characters).",
                                                "examples": [
                                                    "Partner maintenance window"
                                                ]
                                            }
                                        }
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The webhook address, now paused.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "3f1c8a52-7d4e-4b9a-8c26-5e0d1a9b7c34",
                                                "name": "Fleet feed",
                                                "url": "https://hooks.example.com/twi/events?***",
                                                "events": [
                                                    "trip.status_changed",
                                                    "alert.opened"
                                                ],
                                                "status": "paused",
                                                "paused_reason": "manual",
                                                "paused_at": "2026-06-01T07:42:10Z",
                                                "consecutive_failures": 0,
                                                "last_success_at": "2026-05-31T22:10:03Z",
                                                "last_failure_at": null,
                                                "approved_at": "2026-05-20T09:00:00Z",
                                                "updated_at": "2026-06-01T07:42:10Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        },
                                                        "url": {
                                                            "type": "string"
                                                        },
                                                        "events": {
                                                            "type": "string"
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "paused_reason": {
                                                            "type": "string"
                                                        },
                                                        "paused_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "consecutive_failures": {
                                                            "type": "string"
                                                        },
                                                        "last_success_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "last_failure_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "approved_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "name",
                                                        "url",
                                                        "events",
                                                        "status",
                                                        "paused_reason",
                                                        "paused_at",
                                                        "consecutive_failures",
                                                        "last_success_at",
                                                        "last_failure_at",
                                                        "approved_at",
                                                        "updated_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "type": "string"
                                                        },
                                                        "timestamp": {
                                                            "type": "string"
                                                        },
                                                        "timezone": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "timezone"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/webhook-endpoints/{uuid}/resume": {
            "post": {
                "operationId": "webhook_endpoints.resume",
                "description": "Starts sending to one of your company's paused addresses again and counts its failures from zero. Set abandon_queued to true to give up the events queued while it was paused instead of sending them now (they cannot be recovered afterwards except by sending each again). Only a paused address can be resumed: any other state answers 409 with reason not_paused. The company's admins are told that a key did it. The Idempotency-Key header is required.\n\nRequires the key scope `platform:webhooks:manage`.",
                "summary": "Resume a webhook address",
                "tags": [
                    "WebhookEndpointAction"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/WebhookResumeRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "abandon_queued": {
                                                "type": "boolean",
                                                "description": "Give up the events queued while the address was paused instead of sending them now.",
                                                "examples": [
                                                    false
                                                ]
                                            },
                                            "reason": {
                                                "type": "string",
                                                "description": "Why you resume it, kept in your company's audit trail only (3 to 200 characters).",
                                                "examples": [
                                                    "Partner fixed the receiver"
                                                ]
                                            }
                                        }
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The webhook address, now active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "3f1c8a52-7d4e-4b9a-8c26-5e0d1a9b7c34",
                                                "name": "Fleet feed",
                                                "url": "https://hooks.example.com/twi/events?***",
                                                "events": [
                                                    "trip.status_changed",
                                                    "alert.opened"
                                                ],
                                                "status": "paused",
                                                "paused_reason": "manual",
                                                "paused_at": "2026-06-01T07:42:10Z",
                                                "consecutive_failures": 0,
                                                "last_success_at": "2026-05-31T22:10:03Z",
                                                "last_failure_at": null,
                                                "approved_at": "2026-05-20T09:00:00Z",
                                                "updated_at": "2026-06-01T07:42:10Z"
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        },
                                                        "url": {
                                                            "type": "string"
                                                        },
                                                        "events": {
                                                            "type": "string"
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "paused_reason": {
                                                            "type": "string"
                                                        },
                                                        "paused_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "consecutive_failures": {
                                                            "type": "string"
                                                        },
                                                        "last_success_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "last_failure_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "approved_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "name",
                                                        "url",
                                                        "events",
                                                        "status",
                                                        "paused_reason",
                                                        "paused_at",
                                                        "consecutive_failures",
                                                        "last_success_at",
                                                        "last_failure_at",
                                                        "approved_at",
                                                        "updated_at"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "type": "string"
                                                        },
                                                        "timestamp": {
                                                            "type": "string"
                                                        },
                                                        "timezone": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "timezone"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/webhook-endpoints/{uuid}/test": {
            "post": {
                "operationId": "webhook_endpoints.test",
                "description": "Sends one signed test event (type webhook.test, a fixed message) to one of your company's active addresses at once and answers with the delivery it made, with its single try. A test is never retried and does not count towards the address's failures. Only an active address can be tested: any other state answers 409 with reason not_active. At most 10 tests an hour per address, and 5 a minute; beyond that the answer is 429. The Idempotency-Key header is required.\n\nRequires the key scope `platform:webhooks:manage`.",
                "summary": "Send a test event to a webhook address",
                "tags": [
                    "WebhookEndpointAction"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/WebhookActionRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "reason": {
                                                "type": "string",
                                                "description": "Why you send it, kept in your company's audit trail only (3 to 200 characters).",
                                                "examples": [
                                                    "Checking the new certificate"
                                                ]
                                            }
                                        }
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The test delivery with its try.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "8b2e6f40-1c93-4d57-a0e8-6f3b9c1d2a75",
                                                "endpoint_uuid": "3f1c8a52-7d4e-4b9a-8c26-5e0d1a9b7c34",
                                                "event_type": "trip.status_changed",
                                                "status": "delivered",
                                                "attempt_count": 2,
                                                "created_at": "2026-06-01T07:40:00Z",
                                                "next_attempt_at": "2026-06-01T07:40:00Z",
                                                "delivered_at": "2026-06-01T07:41:12Z",
                                                "last_http_status": 200,
                                                "last_failure_code": null,
                                                "attempt_log": [
                                                    {
                                                        "attempt_no": 1,
                                                        "started_at": "2026-06-01T07:40:01Z",
                                                        "duration_ms": 840,
                                                        "http_status": 502,
                                                        "failure_code": "http_502"
                                                    },
                                                    {
                                                        "attempt_no": 2,
                                                        "started_at": "2026-06-01T07:41:11Z",
                                                        "duration_ms": 215,
                                                        "http_status": 200,
                                                        "failure_code": null
                                                    }
                                                ]
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uuid": {
                                                    "type": "string"
                                                },
                                                "endpoint_uuid": {
                                                    "type": "string"
                                                },
                                                "event_type": {
                                                    "type": "string"
                                                },
                                                "status": {
                                                    "type": "string"
                                                },
                                                "attempt_count": {
                                                    "type": "string"
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "next_attempt_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "delivered_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "last_http_status": {
                                                    "type": "string"
                                                },
                                                "last_failure_code": {
                                                    "type": "string"
                                                },
                                                "attempt_log": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "uuid",
                                                "endpoint_uuid",
                                                "event_type",
                                                "status",
                                                "attempt_count",
                                                "created_at",
                                                "next_attempt_at",
                                                "delivered_at",
                                                "last_http_status",
                                                "last_failure_code",
                                                "attempt_log"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/maintenance/work-orders": {
            "get": {
                "operationId": "maintenance.work_orders.index",
                "description": "Lists your company's maintenance work orders, oldest first, one page at a time. Each carries the vehicle and plan by uuid, its type, state, odometer and a summary (free text as typed) and the parts and labour cost in minor units, which is empty when the cost cannot be held in the order's currency (empty means unknown, not free); notes, the workshop and cancellation reasons are never shown. A branch-limited key sees only the work orders of the vehicles that are currently in its branch.\n\nRequires the key scope `maintenance:read`.",
                "summary": "List maintenance work orders",
                "tags": [
                    "WorkOrder"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only work orders in this state: open, in_progress, done or cancelled.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "done"
                    },
                    {
                        "name": "vehicle",
                        "in": "query",
                        "description": "Only the maintenance work orders of this vehicle (its uuid).",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only maintenance work orders changed at or after this moment (ISO 8601 with an offset, e.g. 2026-05-01T00:00:00Z).",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of maintenance work orders.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "6c3f8b24-1e79-4a50-b3d6-9a2e7f4c1d08",
                                                    "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                    "plan_uuid": "2a7d9e41-5c63-4b18-9f20-8d1e4a6c3b99",
                                                    "maintenance_type": "preventive",
                                                    "category_code": "oil_change",
                                                    "responsibility": "company",
                                                    "summary": "Oil and filter change",
                                                    "status": "done",
                                                    "awaiting_approval": false,
                                                    "expected_done_on": "2026-05-12",
                                                    "failure_cause_code": null,
                                                    "vehicle_stopped": null,
                                                    "out_of_service_at": null,
                                                    "returned_to_service_at": null,
                                                    "workshop_uuid": "8e1c2d3f-6a47-4b90-9d15-2f3a4b5c6d77",
                                                    "workshop_type": "internal",
                                                    "odometer_km": 130250,
                                                    "parts_cost_minor": 18500,
                                                    "labour_cost_minor": 6000,
                                                    "currency": "SAR",
                                                    "started_at": "2026-05-12T08:00:00Z",
                                                    "done_at": "2026-05-12T11:30:00Z",
                                                    "cancelled_at": null,
                                                    "created_at": "2026-05-10T09:00:00Z",
                                                    "updated_at": "2026-05-12T11:30:00Z",
                                                    "row_version": 3
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh",
                                                "page": {
                                                    "limit": 50,
                                                    "next_cursor": null
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "page": {
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "limit": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        []
                                                                    ]
                                                                },
                                                                "next_cursor": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        []
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "limit",
                                                                "next_cursor"
                                                            ],
                                                            "additionalProperties": []
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timezone": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "page",
                                                "timezone"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            },
            "post": {
                "operationId": "maintenance.work_orders.open",
                "description": "Opens a work order on one of your company's vehicles, as the panel does: what is wrong, its type and category and, for a breakdown, whether the vehicle stopped and since when. A body with a cost, labour or parts field is refused; the costs and the finishing are entered in the panel. Requires the key scope `fleet:maintenance:write`, its owner's right to manage maintenance, and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:maintenance:write`.",
                "summary": "Open a maintenance work order",
                "tags": [
                    "WorkOrderWrite"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Page size, 1 to 200.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "meta.page.next_cursor of the previous page; leave it out for the first page. A cursor that is refused (422) is no longer valid, for example because its record left your view: start again from the first page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/OpenWorkOrderRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "vehicle": {
                                                "type": "string",
                                                "format": "uuid",
                                                "description": "The vehicle, by its uuid.",
                                                "examples": [
                                                    "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11"
                                                ]
                                            },
                                            "summary": {
                                                "type": "string",
                                                "description": "What the work order is for, 3 to 200 characters of plain text.",
                                                "examples": [
                                                    "Brake pads worn on the front axle"
                                                ]
                                            },
                                            "maintenance_type": {
                                                "type": "string",
                                                "description": "scheduled, preventive, corrective or predictive; corrective when left out.",
                                                "examples": [
                                                    "corrective"
                                                ]
                                            },
                                            "category": {
                                                "type": "string",
                                                "description": "The code of the maintenance category.",
                                                "examples": [
                                                    "brake"
                                                ]
                                            },
                                            "facility": {
                                                "type": "string",
                                                "format": "uuid",
                                                "description": "The workshop that will do the work, by its uuid from the places list (kind workshop).",
                                                "examples": [
                                                    "8e1c2d3f-6a47-4b90-9d15-2f3a4b5c6d77"
                                                ]
                                            },
                                            "kept_running": {
                                                "type": "boolean",
                                                "description": "For a breakdown: true when the vehicle kept running.",
                                                "examples": [
                                                    false
                                                ]
                                            },
                                            "out_of_service_at": {
                                                "type": "string",
                                                "format": "date-time",
                                                "description": "For a breakdown that stopped the vehicle: when it stopped, ISO 8601 with an offset.",
                                                "examples": [
                                                    "2026-05-12T07:30:00+03:00"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "vehicle",
                                            "summary"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The work order that was opened.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "6c3f8b24-1e79-4a50-b3d6-9a2e7f4c1d08",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "plan_uuid": "2a7d9e41-5c63-4b18-9f20-8d1e4a6c3b99",
                                                "maintenance_type": "preventive",
                                                "category_code": "oil_change",
                                                "responsibility": "company",
                                                "summary": "Oil and filter change",
                                                "status": "done",
                                                "awaiting_approval": false,
                                                "expected_done_on": "2026-05-12",
                                                "failure_cause_code": null,
                                                "vehicle_stopped": null,
                                                "out_of_service_at": null,
                                                "returned_to_service_at": null,
                                                "workshop_uuid": "8e1c2d3f-6a47-4b90-9d15-2f3a4b5c6d77",
                                                "workshop_type": "internal",
                                                "odometer_km": 130250,
                                                "parts_cost_minor": 18500,
                                                "labour_cost_minor": 6000,
                                                "currency": "SAR",
                                                "started_at": "2026-05-12T08:00:00Z",
                                                "done_at": "2026-05-12T11:30:00Z",
                                                "cancelled_at": null,
                                                "created_at": "2026-05-10T09:00:00Z",
                                                "updated_at": "2026-05-12T11:30:00Z",
                                                "row_version": 3
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uuid": {
                                                    "type": "string"
                                                },
                                                "vehicle_uuid": {
                                                    "type": "string"
                                                },
                                                "plan_uuid": {
                                                    "type": "string"
                                                },
                                                "maintenance_type": {
                                                    "type": "string"
                                                },
                                                "category_code": {
                                                    "type": "string"
                                                },
                                                "responsibility": {
                                                    "type": "string"
                                                },
                                                "summary": {
                                                    "type": "string"
                                                },
                                                "status": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        {
                                                            "type": "string",
                                                            "enum": [
                                                                "in_progress"
                                                            ]
                                                        }
                                                    ]
                                                },
                                                "awaiting_approval": {
                                                    "type": "string"
                                                },
                                                "expected_done_on": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "failure_cause_code": {
                                                    "type": "string"
                                                },
                                                "vehicle_stopped": {
                                                    "type": "string"
                                                },
                                                "out_of_service_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "returned_to_service_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "workshop_uuid": {
                                                    "type": "string"
                                                },
                                                "workshop_type": {
                                                    "type": "string"
                                                },
                                                "odometer_km": {
                                                    "type": [
                                                        "number",
                                                        "null"
                                                    ]
                                                },
                                                "parts_cost_minor": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "labour_cost_minor": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "currency": {
                                                    "type": "string"
                                                },
                                                "started_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "done_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "cancelled_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "row_version": {
                                                    "type": "integer"
                                                }
                                            },
                                            "required": [
                                                "uuid",
                                                "vehicle_uuid",
                                                "plan_uuid",
                                                "maintenance_type",
                                                "category_code",
                                                "responsibility",
                                                "summary",
                                                "status",
                                                "awaiting_approval",
                                                "expected_done_on",
                                                "failure_cause_code",
                                                "vehicle_stopped",
                                                "out_of_service_at",
                                                "returned_to_service_at",
                                                "workshop_uuid",
                                                "workshop_type",
                                                "odometer_km",
                                                "parts_cost_minor",
                                                "labour_cost_minor",
                                                "currency",
                                                "started_at",
                                                "done_at",
                                                "cancelled_at",
                                                "created_at",
                                                "updated_at",
                                                "row_version"
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                },
                                                "timestamp": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        []
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp"
                                            ],
                                            "additionalProperties": []
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_failed: a filter, the limit or the cursor is not valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/maintenance/work-orders/{uuid}": {
            "get": {
                "operationId": "maintenance.work_orders.show",
                "description": "Reads one of your company's maintenance work orders by its uuid. A record of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `maintenance:read`.",
                "summary": "Read a maintenance work order",
                "tags": [
                    "WorkOrder"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The maintenance work order.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "6c3f8b24-1e79-4a50-b3d6-9a2e7f4c1d08",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "plan_uuid": "2a7d9e41-5c63-4b18-9f20-8d1e4a6c3b99",
                                                "maintenance_type": "preventive",
                                                "category_code": "oil_change",
                                                "responsibility": "company",
                                                "summary": "Oil and filter change",
                                                "status": "done",
                                                "awaiting_approval": false,
                                                "expected_done_on": "2026-05-12",
                                                "failure_cause_code": null,
                                                "vehicle_stopped": null,
                                                "out_of_service_at": null,
                                                "returned_to_service_at": null,
                                                "workshop_uuid": "8e1c2d3f-6a47-4b90-9d15-2f3a4b5c6d77",
                                                "workshop_type": "internal",
                                                "odometer_km": 130250,
                                                "parts_cost_minor": 18500,
                                                "labour_cost_minor": 6000,
                                                "currency": "SAR",
                                                "started_at": "2026-05-12T08:00:00Z",
                                                "done_at": "2026-05-12T11:30:00Z",
                                                "cancelled_at": null,
                                                "created_at": "2026-05-10T09:00:00Z",
                                                "updated_at": "2026-05-12T11:30:00Z",
                                                "row_version": 3
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "additionalProperties": []
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "request_id": {
                                                    "type": "string"
                                                },
                                                "timestamp": {
                                                    "type": "string"
                                                },
                                                "timezone": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "request_id",
                                                "timestamp",
                                                "timezone"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "data",
                                        "error",
                                        "meta"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/maintenance/work-orders/{uuid}/complete": {
            "post": {
                "operationId": "maintenance.work_orders.complete",
                "description": "Finishes an open or in-progress work order and writes its labour cost, as the panel does, with the same rules: the odometer may not go backwards, a breakdown needs its category and cause, and a breakdown that stopped the vehicle needs the time it returned. When your company approves finished repairs, the order then waits for approval and the answer says `awaiting_approval`. The parts cost is never sent: it stays the sum of the part lines. It works only when your company turned on the setting «a key may finish a work order», otherwise it answers 403 with the reason `feature_off`. Send the `row_version` you read; a changed, frozen or finished order answers 409. Requires the key scope `fleet:work_orders:complete` and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:work_orders:complete`.",
                "summary": "Finish a maintenance work order",
                "tags": [
                    "WorkOrderComplete"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "row_version": {
                                        "type": "integer",
                                        "description": "The version of the work order you read.",
                                        "examples": [
                                            2
                                        ]
                                    },
                                    "labour_cost": {
                                        "type": "string",
                                        "description": "The labour cost as a decimal string in the order's currency; it must be sent, 0 included.",
                                        "examples": [
                                            "150.00"
                                        ]
                                    },
                                    "done_on": {
                                        "type": "string",
                                        "description": "The day it was finished, YYYY-MM-DD, not in the future; today when left out.",
                                        "examples": [
                                            "2026-06-01"
                                        ]
                                    },
                                    "odometer_km": {
                                        "type": "string",
                                        "description": "The odometer in kilometres at the finish.",
                                        "examples": [
                                            "125430.5"
                                        ]
                                    },
                                    "category": {
                                        "type": "string",
                                        "description": "The code of the maintenance category.",
                                        "examples": [
                                            "brake"
                                        ]
                                    },
                                    "cause": {
                                        "type": "string",
                                        "description": "The code of the failure cause, for a breakdown.",
                                        "examples": [
                                            "wear"
                                        ]
                                    },
                                    "returned_to_service_at": {
                                        "type": "string",
                                        "format": "date-time",
                                        "description": "When the vehicle returned to service, ISO 8601 with an offset, for a breakdown that stopped it.",
                                        "examples": [
                                            "2026-06-01T15:00:00+03:00"
                                        ]
                                    }
                                },
                                "required": [
                                    "row_version",
                                    "labour_cost"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The work order, finished or awaiting approval.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "6c3f8b24-1e79-4a50-b3d6-9a2e7f4c1d08",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "plan_uuid": "2a7d9e41-5c63-4b18-9f20-8d1e4a6c3b99",
                                                "maintenance_type": "preventive",
                                                "category_code": "oil_change",
                                                "responsibility": "company",
                                                "summary": "Oil and filter change",
                                                "status": "done",
                                                "awaiting_approval": false,
                                                "expected_done_on": "2026-05-12",
                                                "failure_cause_code": null,
                                                "vehicle_stopped": null,
                                                "out_of_service_at": null,
                                                "returned_to_service_at": null,
                                                "workshop_uuid": "8e1c2d3f-6a47-4b90-9d15-2f3a4b5c6d77",
                                                "workshop_type": "internal",
                                                "odometer_km": 130250,
                                                "parts_cost_minor": 18500,
                                                "labour_cost_minor": 6000,
                                                "currency": "SAR",
                                                "started_at": "2026-05-12T08:00:00Z",
                                                "done_at": "2026-05-12T11:30:00Z",
                                                "cancelled_at": null,
                                                "created_at": "2026-05-10T09:00:00Z",
                                                "updated_at": "2026-05-12T11:30:00Z",
                                                "row_version": 3
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "vehicle_uuid": {
                                                            "type": "string"
                                                        },
                                                        "plan_uuid": {
                                                            "type": "string"
                                                        },
                                                        "maintenance_type": {
                                                            "type": "string"
                                                        },
                                                        "category_code": {
                                                            "type": "string"
                                                        },
                                                        "responsibility": {
                                                            "type": "string"
                                                        },
                                                        "summary": {
                                                            "type": "string"
                                                        },
                                                        "status": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                {
                                                                    "type": "string",
                                                                    "enum": [
                                                                        "in_progress"
                                                                    ]
                                                                }
                                                            ]
                                                        },
                                                        "awaiting_approval": {
                                                            "type": "string"
                                                        },
                                                        "expected_done_on": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "failure_cause_code": {
                                                            "type": "string"
                                                        },
                                                        "vehicle_stopped": {
                                                            "type": "string"
                                                        },
                                                        "out_of_service_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "returned_to_service_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "workshop_uuid": {
                                                            "type": "string"
                                                        },
                                                        "workshop_type": {
                                                            "type": "string"
                                                        },
                                                        "odometer_km": {
                                                            "type": [
                                                                "number",
                                                                "null"
                                                            ]
                                                        },
                                                        "parts_cost_minor": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ]
                                                        },
                                                        "labour_cost_minor": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ]
                                                        },
                                                        "currency": {
                                                            "type": "string"
                                                        },
                                                        "started_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "done_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "cancelled_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "row_version": {
                                                            "type": "integer"
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "vehicle_uuid",
                                                        "plan_uuid",
                                                        "maintenance_type",
                                                        "category_code",
                                                        "responsibility",
                                                        "summary",
                                                        "status",
                                                        "awaiting_approval",
                                                        "expected_done_on",
                                                        "failure_cause_code",
                                                        "vehicle_stopped",
                                                        "out_of_service_at",
                                                        "returned_to_service_at",
                                                        "workshop_uuid",
                                                        "workshop_type",
                                                        "odometer_km",
                                                        "parts_cost_minor",
                                                        "labour_cost_minor",
                                                        "currency",
                                                        "started_at",
                                                        "done_at",
                                                        "cancelled_at",
                                                        "created_at",
                                                        "updated_at",
                                                        "row_version"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/maintenance/work-orders/{uuid}/parts": {
            "get": {
                "operationId": "maintenance.work_orders.parts.index",
                "description": "Lists the part lines of one of your company's work orders, oldest first, one page at a time: each line is an issue to the order or a return from it, with the part and the signed quantity; never a cost, a reason or a person. A work order of another company or branch answers 404 exactly like one that does not exist.\n\nRequires the key scope `maintenance:read`.",
                "summary": "List the parts of a maintenance work order",
                "tags": [
                    "WorkOrderPart"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of part lines.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": [
                                                {
                                                    "uuid": "5e7f9a21-3b4c-4d68-9e0a-1f2b3c4d5e66",
                                                    "work_order_uuid": "6c3f8b24-1e79-4a50-b3d6-9a2e7f4c1d08",
                                                    "part_uuid": "3c5d8e12-4f6a-4b79-8a21-7d9e0f1b2c34",
                                                    "part_number": "OF-1234",
                                                    "kind": "issue",
                                                    "quantity": "2.000",
                                                    "created_at": "2026-05-12T09:15:00Z"
                                                }
                                            ],
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": []
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "page": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "limit": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": "integer"
                                                                                },
                                                                                []
                                                                            ]
                                                                        },
                                                                        "next_cursor": {
                                                                            "anyOf": [
                                                                                {
                                                                                    "type": [
                                                                                        "string",
                                                                                        "null"
                                                                                    ]
                                                                                },
                                                                                []
                                                                            ]
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "limit",
                                                                        "next_cursor"
                                                                    ],
                                                                    "additionalProperties": []
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timezone": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp",
                                                        "page",
                                                        "timezone"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/maintenance/work-orders/{uuid}/start": {
            "post": {
                "operationId": "maintenance.work_orders.start",
                "description": "Marks an open work order as started. Send the `row_version` you read: a work order changed meanwhile answers 409. Requires the key scope `fleet:maintenance:write` and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:maintenance:write`.",
                "summary": "Start a maintenance work order",
                "tags": [
                    "WorkOrderWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/WorkOrderActionRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The version of the work order you read.",
                                                "examples": [
                                                    1
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The work order, now in progress.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "6c3f8b24-1e79-4a50-b3d6-9a2e7f4c1d08",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "plan_uuid": "2a7d9e41-5c63-4b18-9f20-8d1e4a6c3b99",
                                                "maintenance_type": "preventive",
                                                "category_code": "oil_change",
                                                "responsibility": "company",
                                                "summary": "Oil and filter change",
                                                "status": "done",
                                                "awaiting_approval": false,
                                                "expected_done_on": "2026-05-12",
                                                "failure_cause_code": null,
                                                "vehicle_stopped": null,
                                                "out_of_service_at": null,
                                                "returned_to_service_at": null,
                                                "workshop_uuid": "8e1c2d3f-6a47-4b90-9d15-2f3a4b5c6d77",
                                                "workshop_type": "internal",
                                                "odometer_km": 130250,
                                                "parts_cost_minor": 18500,
                                                "labour_cost_minor": 6000,
                                                "currency": "SAR",
                                                "started_at": "2026-05-12T08:00:00Z",
                                                "done_at": "2026-05-12T11:30:00Z",
                                                "cancelled_at": null,
                                                "created_at": "2026-05-10T09:00:00Z",
                                                "updated_at": "2026-05-12T11:30:00Z",
                                                "row_version": 3
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "vehicle_uuid": {
                                                            "type": "string"
                                                        },
                                                        "plan_uuid": {
                                                            "type": "string"
                                                        },
                                                        "maintenance_type": {
                                                            "type": "string"
                                                        },
                                                        "category_code": {
                                                            "type": "string"
                                                        },
                                                        "responsibility": {
                                                            "type": "string"
                                                        },
                                                        "summary": {
                                                            "type": "string"
                                                        },
                                                        "status": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                {
                                                                    "type": "string",
                                                                    "enum": [
                                                                        "in_progress"
                                                                    ]
                                                                }
                                                            ]
                                                        },
                                                        "awaiting_approval": {
                                                            "type": "string"
                                                        },
                                                        "expected_done_on": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "failure_cause_code": {
                                                            "type": "string"
                                                        },
                                                        "vehicle_stopped": {
                                                            "type": "string"
                                                        },
                                                        "out_of_service_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "returned_to_service_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "workshop_uuid": {
                                                            "type": "string"
                                                        },
                                                        "workshop_type": {
                                                            "type": "string"
                                                        },
                                                        "odometer_km": {
                                                            "type": [
                                                                "number",
                                                                "null"
                                                            ]
                                                        },
                                                        "parts_cost_minor": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ]
                                                        },
                                                        "labour_cost_minor": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ]
                                                        },
                                                        "currency": {
                                                            "type": "string"
                                                        },
                                                        "started_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "done_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "cancelled_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "row_version": {
                                                            "type": "integer"
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "vehicle_uuid",
                                                        "plan_uuid",
                                                        "maintenance_type",
                                                        "category_code",
                                                        "responsibility",
                                                        "summary",
                                                        "status",
                                                        "awaiting_approval",
                                                        "expected_done_on",
                                                        "failure_cause_code",
                                                        "vehicle_stopped",
                                                        "out_of_service_at",
                                                        "returned_to_service_at",
                                                        "workshop_uuid",
                                                        "workshop_type",
                                                        "odometer_km",
                                                        "parts_cost_minor",
                                                        "labour_cost_minor",
                                                        "currency",
                                                        "started_at",
                                                        "done_at",
                                                        "cancelled_at",
                                                        "created_at",
                                                        "updated_at",
                                                        "row_version"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/maintenance/work-orders/{uuid}/cancel": {
            "post": {
                "operationId": "maintenance.work_orders.cancel",
                "description": "Cancels a work order that is not finished; the parts issued to it go back to their warehouses. A cancelled order is final. Send the `row_version` you read and the reason. Requires the key scope `fleet:maintenance:write` and an `Idempotency-Key` header.\n\nRequires the key scope `fleet:maintenance:write`.",
                "summary": "Cancel a maintenance work order",
                "tags": [
                    "WorkOrderWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/WorkOrderActionRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The version of the work order you read.",
                                                "examples": [
                                                    2
                                                ]
                                            },
                                            "reason": {
                                                "type": "string",
                                                "description": "Why it is cancelled, 10 to 500 characters of plain text.",
                                                "examples": [
                                                    "Opened twice by mistake"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version",
                                            "reason"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The work order, now cancelled.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "6c3f8b24-1e79-4a50-b3d6-9a2e7f4c1d08",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "plan_uuid": "2a7d9e41-5c63-4b18-9f20-8d1e4a6c3b99",
                                                "maintenance_type": "preventive",
                                                "category_code": "oil_change",
                                                "responsibility": "company",
                                                "summary": "Oil and filter change",
                                                "status": "done",
                                                "awaiting_approval": false,
                                                "expected_done_on": "2026-05-12",
                                                "failure_cause_code": null,
                                                "vehicle_stopped": null,
                                                "out_of_service_at": null,
                                                "returned_to_service_at": null,
                                                "workshop_uuid": "8e1c2d3f-6a47-4b90-9d15-2f3a4b5c6d77",
                                                "workshop_type": "internal",
                                                "odometer_km": 130250,
                                                "parts_cost_minor": 18500,
                                                "labour_cost_minor": 6000,
                                                "currency": "SAR",
                                                "started_at": "2026-05-12T08:00:00Z",
                                                "done_at": "2026-05-12T11:30:00Z",
                                                "cancelled_at": null,
                                                "created_at": "2026-05-10T09:00:00Z",
                                                "updated_at": "2026-05-12T11:30:00Z",
                                                "row_version": 3
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-06-01T09:00:00Z",
                                                "timezone": "Asia/Riyadh"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "vehicle_uuid": {
                                                            "type": "string"
                                                        },
                                                        "plan_uuid": {
                                                            "type": "string"
                                                        },
                                                        "maintenance_type": {
                                                            "type": "string"
                                                        },
                                                        "category_code": {
                                                            "type": "string"
                                                        },
                                                        "responsibility": {
                                                            "type": "string"
                                                        },
                                                        "summary": {
                                                            "type": "string"
                                                        },
                                                        "status": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                {
                                                                    "type": "string",
                                                                    "enum": [
                                                                        "in_progress"
                                                                    ]
                                                                }
                                                            ]
                                                        },
                                                        "awaiting_approval": {
                                                            "type": "string"
                                                        },
                                                        "expected_done_on": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "failure_cause_code": {
                                                            "type": "string"
                                                        },
                                                        "vehicle_stopped": {
                                                            "type": "string"
                                                        },
                                                        "out_of_service_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "returned_to_service_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "workshop_uuid": {
                                                            "type": "string"
                                                        },
                                                        "workshop_type": {
                                                            "type": "string"
                                                        },
                                                        "odometer_km": {
                                                            "type": [
                                                                "number",
                                                                "null"
                                                            ]
                                                        },
                                                        "parts_cost_minor": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ]
                                                        },
                                                        "labour_cost_minor": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ]
                                                        },
                                                        "currency": {
                                                            "type": "string"
                                                        },
                                                        "started_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "done_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "cancelled_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "row_version": {
                                                            "type": "integer"
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "vehicle_uuid",
                                                        "plan_uuid",
                                                        "maintenance_type",
                                                        "category_code",
                                                        "responsibility",
                                                        "summary",
                                                        "status",
                                                        "awaiting_approval",
                                                        "expected_done_on",
                                                        "failure_cause_code",
                                                        "vehicle_stopped",
                                                        "out_of_service_at",
                                                        "returned_to_service_at",
                                                        "workshop_uuid",
                                                        "workshop_type",
                                                        "odometer_km",
                                                        "parts_cost_minor",
                                                        "labour_cost_minor",
                                                        "currency",
                                                        "started_at",
                                                        "done_at",
                                                        "cancelled_at",
                                                        "created_at",
                                                        "updated_at",
                                                        "row_version"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/maintenance/work-orders/{uuid}/approve": {
            "post": {
                "operationId": "maintenance.work_orders.approve",
                "description": "Approves a work order the workshop reported as finished: it closes on the day reported, the odometer reading and the plan's next cycle are recorded and the defects it fixed are resolved, as in the panel. Send the `row_version` you read: a changed order answers 409. An order cannot be approved with the key of the person who submitted it. Requires the key scope `fleet:repair_approval:write` and an owner who may approve repairs.\n\nRequires the key scope `fleet:repair_approval:write`.",
                "summary": "Approve a finished repair",
                "tags": [
                    "WorkOrderWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/WorkOrderActionRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The version of the work order you read.",
                                                "examples": [
                                                    4
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The work order, now done.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "6c3f8b24-1e79-4a50-b3d6-9a2e7f4c1d08",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "plan_uuid": "2a7d9e41-5c63-4b18-9f20-8d1e4a6c3b99",
                                                "maintenance_type": "preventive",
                                                "category_code": "oil_change",
                                                "responsibility": "company",
                                                "summary": "Oil and filter change",
                                                "status": "done",
                                                "awaiting_approval": false,
                                                "expected_done_on": "2026-05-12",
                                                "failure_cause_code": null,
                                                "vehicle_stopped": null,
                                                "out_of_service_at": null,
                                                "returned_to_service_at": null,
                                                "workshop_uuid": "8e1c2d3f-6a47-4b90-9d15-2f3a4b5c6d77",
                                                "workshop_type": "internal",
                                                "odometer_km": 130250,
                                                "parts_cost_minor": 18500,
                                                "labour_cost_minor": 6000,
                                                "currency": "SAR",
                                                "started_at": "2026-05-12T08:00:00Z",
                                                "done_at": "2026-05-12T11:30:00Z",
                                                "cancelled_at": null,
                                                "created_at": "2026-05-10T09:00:00Z",
                                                "updated_at": "2026-05-12T11:30:00Z",
                                                "row_version": 3
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-05-12T07:30:00+00:00"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "vehicle_uuid": {
                                                            "type": "string"
                                                        },
                                                        "plan_uuid": {
                                                            "type": "string"
                                                        },
                                                        "maintenance_type": {
                                                            "type": "string"
                                                        },
                                                        "category_code": {
                                                            "type": "string"
                                                        },
                                                        "responsibility": {
                                                            "type": "string"
                                                        },
                                                        "summary": {
                                                            "type": "string"
                                                        },
                                                        "status": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                {
                                                                    "type": "string",
                                                                    "enum": [
                                                                        "in_progress"
                                                                    ]
                                                                }
                                                            ]
                                                        },
                                                        "awaiting_approval": {
                                                            "type": "string"
                                                        },
                                                        "expected_done_on": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "failure_cause_code": {
                                                            "type": "string"
                                                        },
                                                        "vehicle_stopped": {
                                                            "type": "string"
                                                        },
                                                        "out_of_service_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "returned_to_service_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "workshop_uuid": {
                                                            "type": "string"
                                                        },
                                                        "workshop_type": {
                                                            "type": "string"
                                                        },
                                                        "odometer_km": {
                                                            "type": [
                                                                "number",
                                                                "null"
                                                            ]
                                                        },
                                                        "parts_cost_minor": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ]
                                                        },
                                                        "labour_cost_minor": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ]
                                                        },
                                                        "currency": {
                                                            "type": "string"
                                                        },
                                                        "started_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "done_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "cancelled_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "row_version": {
                                                            "type": "integer"
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "vehicle_uuid",
                                                        "plan_uuid",
                                                        "maintenance_type",
                                                        "category_code",
                                                        "responsibility",
                                                        "summary",
                                                        "status",
                                                        "awaiting_approval",
                                                        "expected_done_on",
                                                        "failure_cause_code",
                                                        "vehicle_stopped",
                                                        "out_of_service_at",
                                                        "returned_to_service_at",
                                                        "workshop_uuid",
                                                        "workshop_type",
                                                        "odometer_km",
                                                        "parts_cost_minor",
                                                        "labour_cost_minor",
                                                        "currency",
                                                        "started_at",
                                                        "done_at",
                                                        "cancelled_at",
                                                        "created_at",
                                                        "updated_at",
                                                        "row_version"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        },
        "/maintenance/work-orders/{uuid}/rework": {
            "post": {
                "operationId": "maintenance.work_orders.rework",
                "description": "Returns a work order that waits for approval to the workshop with the reason; it is in progress again and the vehicle is no longer back in service. Send the `row_version` you read: a changed order answers 409. Requires the key scope `fleet:repair_approval:write` and an owner who may approve repairs.\n\nRequires the key scope `fleet:repair_approval:write`.",
                "summary": "Send a finished repair back",
                "tags": [
                    "WorkOrderWrite"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-Request-Id",
                        "in": "header",
                        "description": "Optional correlation id, echoed in the header and in meta.request_id.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9._-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/ReworkWorkOrderRequest"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "row_version": {
                                                "type": "integer",
                                                "description": "The version of the work order you read.",
                                                "examples": [
                                                    4
                                                ]
                                            },
                                            "reason": {
                                                "type": "string",
                                                "description": "Why it goes back, 10 to 500 characters of plain text.",
                                                "examples": [
                                                    "The brake pads were not replaced on the rear axle"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "row_version",
                                            "reason"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The work order, in progress again.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "examples": [
                                        {
                                            "success": true,
                                            "data": {
                                                "uuid": "6c3f8b24-1e79-4a50-b3d6-9a2e7f4c1d08",
                                                "vehicle_uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11",
                                                "plan_uuid": "2a7d9e41-5c63-4b18-9f20-8d1e4a6c3b99",
                                                "maintenance_type": "preventive",
                                                "category_code": "oil_change",
                                                "responsibility": "company",
                                                "summary": "Oil and filter change",
                                                "status": "done",
                                                "awaiting_approval": false,
                                                "expected_done_on": "2026-05-12",
                                                "failure_cause_code": null,
                                                "vehicle_stopped": null,
                                                "out_of_service_at": null,
                                                "returned_to_service_at": null,
                                                "workshop_uuid": "8e1c2d3f-6a47-4b90-9d15-2f3a4b5c6d77",
                                                "workshop_type": "internal",
                                                "odometer_km": 130250,
                                                "parts_cost_minor": 18500,
                                                "labour_cost_minor": 6000,
                                                "currency": "SAR",
                                                "started_at": "2026-05-12T08:00:00Z",
                                                "done_at": "2026-05-12T11:30:00Z",
                                                "cancelled_at": null,
                                                "created_at": "2026-05-10T09:00:00Z",
                                                "updated_at": "2026-05-12T11:30:00Z",
                                                "row_version": 3
                                            },
                                            "error": null,
                                            "meta": {
                                                "request_id": "req-1",
                                                "timestamp": "2026-05-12T07:30:00+00:00"
                                            }
                                        }
                                    ],
                                    "anyOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "uuid": {
                                                            "type": "string"
                                                        },
                                                        "vehicle_uuid": {
                                                            "type": "string"
                                                        },
                                                        "plan_uuid": {
                                                            "type": "string"
                                                        },
                                                        "maintenance_type": {
                                                            "type": "string"
                                                        },
                                                        "category_code": {
                                                            "type": "string"
                                                        },
                                                        "responsibility": {
                                                            "type": "string"
                                                        },
                                                        "summary": {
                                                            "type": "string"
                                                        },
                                                        "status": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                {
                                                                    "type": "string",
                                                                    "enum": [
                                                                        "in_progress"
                                                                    ]
                                                                }
                                                            ]
                                                        },
                                                        "awaiting_approval": {
                                                            "type": "string"
                                                        },
                                                        "expected_done_on": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "failure_cause_code": {
                                                            "type": "string"
                                                        },
                                                        "vehicle_stopped": {
                                                            "type": "string"
                                                        },
                                                        "out_of_service_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "returned_to_service_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "workshop_uuid": {
                                                            "type": "string"
                                                        },
                                                        "workshop_type": {
                                                            "type": "string"
                                                        },
                                                        "odometer_km": {
                                                            "type": [
                                                                "number",
                                                                "null"
                                                            ]
                                                        },
                                                        "parts_cost_minor": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ]
                                                        },
                                                        "labour_cost_minor": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ]
                                                        },
                                                        "currency": {
                                                            "type": "string"
                                                        },
                                                        "started_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "done_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "cancelled_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "updated_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "row_version": {
                                                            "type": "integer"
                                                        }
                                                    },
                                                    "required": [
                                                        "uuid",
                                                        "vehicle_uuid",
                                                        "plan_uuid",
                                                        "maintenance_type",
                                                        "category_code",
                                                        "responsibility",
                                                        "summary",
                                                        "status",
                                                        "awaiting_approval",
                                                        "expected_done_on",
                                                        "failure_cause_code",
                                                        "vehicle_stopped",
                                                        "out_of_service_at",
                                                        "returned_to_service_at",
                                                        "workshop_uuid",
                                                        "workshop_type",
                                                        "odometer_km",
                                                        "parts_cost_minor",
                                                        "labour_cost_minor",
                                                        "currency",
                                                        "started_at",
                                                        "done_at",
                                                        "cancelled_at",
                                                        "created_at",
                                                        "updated_at",
                                                        "row_version"
                                                    ]
                                                },
                                                "error": {
                                                    "type": "null"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "request_id": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        },
                                                        "timestamp": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                []
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "request_id",
                                                        "timestamp"
                                                    ],
                                                    "additionalProperties": []
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data",
                                                "error",
                                                "meta"
                                            ]
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden: the key lacks the scope this call needs, or its owner may not see this resource; api_not_in_plan: your plan has no API access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "unauthenticated: the key is missing, expired or revoked.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "404": {
                        "description": "not_found: no such record for this key (a record of another company or branch answers the same).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "service_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "internal_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiErrorEnvelope"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "companyKey": []
                    }
                ]
            }
        }
    },
    "components": {
        "securitySchemes": {
            "sourceToken": {
                "type": "http",
                "description": "Token of one source instance, ability telemetry:ingest, always with an expiry. Shown once at creation.",
                "scheme": "bearer"
            },
            "companyKey": {
                "type": "http",
                "description": "A key a company administrator creates under «مفاتيح API» in the portal. It carries one scope per resource it may read, always has an expiry, is shown once, and reaches only that company's data.",
                "scheme": "bearer"
            }
        },
        "schemas": {
            "AddCaseNoteRequest": {
                "type": "object",
                "description": "The body of a note added to a case by key: plain text for the case timeline.",
                "properties": {
                    "note": {
                        "type": "string",
                        "maxLength": 500
                    }
                },
                "required": [
                    "note"
                ],
                "title": "AddCaseNoteRequest"
            },
            "AdvanceCaseRequest": {
                "type": "object",
                "description": "The body of a case move by key: the version the caller read, nothing else.",
                "properties": {
                    "row_version": {
                        "type": "integer",
                        "minimum": 1
                    }
                },
                "required": [
                    "row_version"
                ],
                "title": "AdvanceCaseRequest"
            },
            "ApiError": {
                "type": "object",
                "properties": {
                    "code": {
                        "type": "string",
                        "description": "Clients branch on the code, never on the message. invalid_json (400), bad_request (400), unauthenticated (401), forbidden (403), api_not_in_plan (403), second_factor_required (403), plan_feature_required (403), https_required (403), not_found (404), method_not_allowed (405), idempotency_conflict (409), conflict (409), payload_too_large (413), unsupported_media_type (415), validation_failed (422), batch_too_large (422), rate_limited (429), internal_error (500), service_unavailable (503)",
                        "enum": [
                            "invalid_json",
                            "bad_request",
                            "unauthenticated",
                            "forbidden",
                            "api_not_in_plan",
                            "second_factor_required",
                            "plan_feature_required",
                            "https_required",
                            "not_found",
                            "method_not_allowed",
                            "idempotency_conflict",
                            "conflict",
                            "payload_too_large",
                            "unsupported_media_type",
                            "validation_failed",
                            "batch_too_large",
                            "rate_limited",
                            "internal_error",
                            "service_unavailable"
                        ]
                    },
                    "message": {
                        "type": "string",
                        "description": "English, or Arabic when Accept-Language starts with ar."
                    },
                    "reason": {
                        "type": "string",
                        "description": "Optional. One English snake_case word for the domain reason under the code (for example the plan feature a plan_feature_required answer asks for); never text for a person.",
                        "pattern": "^[a-z][a-z0-9_.]{0,59}$"
                    },
                    "details": {
                        "type": "array",
                        "description": "Only for validation_failed and batch_too_large.",
                        "items": {
                            "$ref": "#/components/schemas/ApiErrorDetail"
                        }
                    }
                },
                "required": [
                    "code",
                    "message"
                ],
                "title": "ApiError"
            },
            "ApiErrorDetail": {
                "type": "object",
                "properties": {
                    "field": {
                        "type": "string",
                        "examples": [
                            "observations.3.latitude"
                        ]
                    },
                    "code": {
                        "type": "string",
                        "enum": [
                            "required",
                            "invalid_type",
                            "out_of_range",
                            "too_long",
                            "invalid_format",
                            "naive_timestamp",
                            "unknown_value",
                            "mutually_exclusive",
                            "unit_mismatch"
                        ]
                    },
                    "message": {
                        "type": "string"
                    }
                },
                "required": [
                    "field",
                    "code",
                    "message"
                ],
                "title": "ApiErrorDetail"
            },
            "ApiErrorEnvelope": {
                "type": "object",
                "properties": {
                    "success": {
                        "type": "boolean",
                        "const": false
                    },
                    "data": {
                        "type": "null"
                    },
                    "error": {
                        "$ref": "#/components/schemas/ApiError"
                    },
                    "meta": {
                        "$ref": "#/components/schemas/ApiMeta"
                    }
                },
                "required": [
                    "success",
                    "data",
                    "error",
                    "meta"
                ],
                "title": "ApiErrorEnvelope"
            },
            "ApiMeta": {
                "type": "object",
                "properties": {
                    "request_id": {
                        "type": "string",
                        "description": "Echo of X-Request-Id, or the id TWI generated."
                    },
                    "timestamp": {
                        "type": "string",
                        "format": "date-time",
                        "description": "UTC, Z suffix."
                    },
                    "timezone": {
                        "type": "string",
                        "description": "Company data only: the business time zone the platform shows times in. Every time in the body is UTC.",
                        "examples": [
                            "Asia/Riyadh"
                        ]
                    },
                    "page": {
                        "type": "object",
                        "properties": {
                            "limit": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 200
                            },
                            "next_cursor": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "description": "Send it back as ?cursor= for the next page; null on the last page."
                            }
                        },
                        "required": [
                            "limit",
                            "next_cursor"
                        ]
                    }
                },
                "required": [
                    "request_id",
                    "timestamp"
                ],
                "title": "ApiMeta"
            },
            "ApproveSwapRequest": {
                "type": "object",
                "description": "The body of a head swap approved by key: only the approver's own confirmation of the lines marked unknown.",
                "properties": {
                    "confirm_compatibility": {
                        "type": [
                            "boolean",
                            "null"
                        ]
                    }
                },
                "title": "ApproveSwapRequest"
            },
            "ArchiveAssetRequest": {
                "type": "object",
                "description": "The row version and the reason a key sends to archive a trailer or equipment (F10 AG-3318).",
                "properties": {
                    "row_version": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "reason": {
                        "type": "string",
                        "minLength": 3,
                        "maxLength": 1000
                    }
                },
                "required": [
                    "row_version",
                    "reason"
                ],
                "title": "ArchiveAssetRequest"
            },
            "ArchiveVehicleRequest": {
                "type": "object",
                "description": "What a key sends to archive a vehicle: confirm set to true, because an archive takes the vehicle out of work.",
                "properties": {
                    "confirm": {
                        "enum": [
                            "yes",
                            "on",
                            "1",
                            1,
                            "true",
                            true
                        ]
                    }
                },
                "required": [
                    "confirm"
                ],
                "title": "ArchiveVehicleRequest"
            },
            "AskProviderRequest": {
                "type": "object",
                "description": "The body of a request for help sent to a provider by key: the network base, nothing typed.",
                "properties": {
                    "location_uuid": {
                        "type": "string",
                        "format": "uuid"
                    }
                },
                "required": [
                    "location_uuid"
                ],
                "title": "AskProviderRequest"
            },
            "AssignAssetRequest": {
                "type": "object",
                "description": "The holder a key names to couple a trailer or assign equipment (F10 AG-3318): one vehicle or one driver by uuid; the writer decides which a kind takes.",
                "properties": {
                    "vehicle_uuid": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "uuid"
                    },
                    "driver_uuid": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "uuid"
                    }
                },
                "title": "AssignAssetRequest"
            },
            "AssignFuelCardRequest": {
                "type": "object",
                "description": "What a key sends to change a card's holder: the version it read and the vehicle, the driver or both by uuid, or neither to unassign (F10 AG-2891).",
                "properties": {
                    "row_version": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "vehicle": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "uuid"
                    },
                    "driver": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "uuid"
                    }
                },
                "required": [
                    "row_version"
                ],
                "title": "AssignFuelCardRequest"
            },
            "AttachAccidentClipRequest": {
                "type": "object",
                "description": "What a key sends to attach a camera clip to an accident: the clip's uuid and nothing else.",
                "properties": {
                    "clip": {
                        "type": "string",
                        "format": "uuid"
                    }
                },
                "required": [
                    "clip"
                ],
                "title": "AttachAccidentClipRequest"
            },
            "CanMove": {
                "type": "string",
                "description": "Whether the vehicle can still be driven.\n",
                "enum": [
                    "yes",
                    "no",
                    "unknown"
                ],
                "title": "CanMove"
            },
            "CancelCaseRequest": {
                "type": "object",
                "description": "The body of a case cancellation by key: the version the caller read and the reason, plain text.",
                "properties": {
                    "row_version": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "reason": {
                        "type": "string",
                        "maxLength": 500
                    }
                },
                "required": [
                    "row_version",
                    "reason"
                ],
                "title": "CancelCaseRequest"
            },
            "CancelPayLedgerEntryRequest": {
                "type": "object",
                "description": "What a key may send to cancel a pending pay ledger entry: a reason, plain text without a card number.",
                "properties": {
                    "reason": {
                        "type": "string",
                        "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                        "maxLength": 1000
                    }
                },
                "required": [
                    "reason"
                ],
                "title": "CancelPayLedgerEntryRequest"
            },
            "CancelViolationRequest": {
                "type": "object",
                "description": "What a key sends to cancel a violation: the version it read and a reason.",
                "properties": {
                    "row_version": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "reason": {
                        "type": "string",
                        "maxLength": 1000
                    }
                },
                "required": [
                    "row_version",
                    "reason"
                ],
                "title": "CancelViolationRequest"
            },
            "CaseOutcome": {
                "type": "string",
                "description": "How a roadside case ended, chosen by whoever closes it (D185 WR-20); a repair opens a corrective work order, a swap or a false alarm does not.\n",
                "enum": [
                    "repaired_on_site",
                    "towed_and_repaired",
                    "swapped",
                    "false_alarm"
                ],
                "title": "CaseOutcome"
            },
            "CaseRuleViolation": {
                "type": "object",
                "properties": {
                    "rule": {
                        "type": "string"
                    }
                },
                "required": [
                    "rule"
                ],
                "title": "CaseRuleViolation"
            },
            "CaseSymptom": {
                "type": "string",
                "description": "What the driver or dispatcher says is wrong with the vehicle.\n",
                "enum": [
                    "engine",
                    "tyres",
                    "brakes",
                    "electrical",
                    "battery",
                    "fuel",
                    "accident",
                    "other"
                ],
                "title": "CaseSymptom"
            },
            "CatalogRequestInput": {
                "type": "object",
                "description": "What a key may send to ask the catalogue for a missing make, model or vehicle type: which list and the text as the company writes it; any other field is refused (F8 gap 7 item 3).",
                "properties": {
                    "list": {
                        "type": "string",
                        "enum": [
                            "make",
                            "model",
                            "vehicle_type"
                        ]
                    },
                    "text": {
                        "type": "string",
                        "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                        "minLength": 1,
                        "maxLength": 160
                    }
                },
                "required": [
                    "list",
                    "text"
                ],
                "title": "CatalogRequestInput"
            },
            "CheckItemRequest": {
                "type": "object",
                "description": "What a key sends to record a reading of a fitted item: a tyre's tread or pressure, or a battery's voltage, with the day and optionally the odometer; exactly one reading (F10 AG-2834).",
                "properties": {
                    "occurred_on": {
                        "type": "string",
                        "format": "date"
                    },
                    "tread_mm": {
                        "type": "number",
                        "minimum": 0
                    },
                    "pressure_bar": {
                        "type": "number",
                        "minimum": 0
                    },
                    "voltage_v": {
                        "type": "number",
                        "minimum": 0
                    },
                    "odometer_km": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "minimum": 0
                    },
                    "cost": {
                        "type": "string"
                    }
                },
                "required": [
                    "occurred_on"
                ],
                "title": "CheckItemRequest"
            },
            "CloseCaseRequest": {
                "type": "object",
                "description": "The body of a case close by key: the version the caller read and how the case ended, from the closed list; no note and no work order.",
                "properties": {
                    "row_version": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "outcome": {
                        "$ref": "#/components/schemas/CaseOutcome"
                    }
                },
                "required": [
                    "row_version",
                    "outcome"
                ],
                "title": "CloseCaseRequest"
            },
            "CompanyReportFileRequest": {
                "type": "object",
                "description": "What a company key sends to start a report file (F10 AG-3147): the read's own filters checked the same way, and a reason that goes to the\nprivileged-read record and is never echoed; the file is built in every format the plan allows.",
                "properties": {
                    "reason": {
                        "type": "string",
                        "minLength": 10,
                        "maxLength": 500
                    },
                    "from": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date"
                    },
                    "until": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date"
                    },
                    "branch": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "uuid"
                    },
                    "vehicle": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "uuid"
                    },
                    "driver": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "uuid"
                    },
                    "category": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 60
                    },
                    "group": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[a-z][a-z0-9_]{0,39}$"
                    },
                    "search": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "minLength": 2,
                        "maxLength": 100
                    },
                    "sort": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[a-z][a-z0-9_]{0,59}$"
                    },
                    "direction": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "asc",
                            "desc",
                            null
                        ]
                    },
                    "compare": {
                        "anyOf": [
                            {
                                "$ref": "#/components/schemas/ComparisonKind"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "baseline_from": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date"
                    },
                    "baseline_until": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date"
                    }
                },
                "required": [
                    "reason"
                ],
                "title": "CompanyReportFileRequest"
            },
            "CompanyReportViewRequest": {
                "type": "object",
                "description": "What a company key sends to save a view of a report (F10 AG-3145): a plain name and the read's own filters, checked the same way.",
                "properties": {
                    "name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 60
                    },
                    "is_default": {
                        "type": "boolean"
                    },
                    "from": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date"
                    },
                    "until": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date"
                    },
                    "branch": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "uuid"
                    },
                    "vehicle": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "uuid"
                    },
                    "driver": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "uuid"
                    },
                    "category": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 60
                    },
                    "group": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[a-z][a-z0-9_]{0,39}$"
                    },
                    "search": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "minLength": 2,
                        "maxLength": 100
                    },
                    "sort": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[a-z][a-z0-9_]{0,59}$"
                    },
                    "direction": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "asc",
                            "desc",
                            null
                        ]
                    },
                    "compare": {
                        "anyOf": [
                            {
                                "$ref": "#/components/schemas/ComparisonKind"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "baseline_from": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date"
                    },
                    "baseline_until": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date"
                    }
                },
                "required": [
                    "name"
                ],
                "title": "CompanyReportViewRequest"
            },
            "CompanyTaskCommentRequest": {
                "type": "object",
                "description": "The body of a new comment over the customer API: the text only; any other key is refused.",
                "properties": {
                    "body": {
                        "type": "string",
                        "maxLength": 2000
                    }
                },
                "required": [
                    "body"
                ],
                "title": "CompanyTaskCommentRequest"
            },
            "CompanyTaskCreateRequest": {
                "type": "object",
                "description": "The body of a company task create: a title, optional instructions and due time; the company, branch and every other field are refused (F10 AG-3000 slice B).",
                "properties": {
                    "title": {
                        "type": "string",
                        "maxLength": 250
                    },
                    "instructions": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 5000
                    },
                    "due_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                },
                "required": [
                    "title"
                ],
                "title": "CompanyTaskCreateRequest"
            },
            "CompanyTaskMoveRequest": {
                "type": "object",
                "description": "The body of a change to one company task over the customer API: the version the caller read, plus what the change needs; any other key is refused.",
                "properties": {
                    "version": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "reason": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 1000
                    },
                    "assignee": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "uuid"
                    },
                    "title": {
                        "type": "string",
                        "maxLength": 250
                    },
                    "instructions": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 5000
                    },
                    "due_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                },
                "required": [
                    "version",
                    "title"
                ],
                "title": "CompanyTaskMoveRequest"
            },
            "ComparisonKind": {
                "type": "string",
                "description": "What a report's period is compared with: the days just before it, the same days a year earlier, or dates the reader chooses.\n",
                "enum": [
                    "previous",
                    "last_year",
                    "custom"
                ],
                "title": "ComparisonKind"
            },
            "ComputePaySheetRequest": {
                "type": "object",
                "description": "What a key may send to compute a draft pay sheet: the month (Y-m) and, optionally, the currency.",
                "properties": {
                    "month": {
                        "type": "string"
                    },
                    "currency": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "minLength": 3,
                        "maxLength": 3
                    }
                },
                "required": [
                    "month"
                ],
                "title": "ComputePaySheetRequest"
            },
            "CostKind": {
                "type": "string",
                "description": "What an invoice of a roadside case is for (D185 WR-20b); a tow can be recorded as an expense of the vehicle.\n",
                "enum": [
                    "repair",
                    "tow",
                    "other"
                ],
                "title": "CostKind"
            },
            "CountStockRequest": {
                "type": "object",
                "description": "A count of one warehouse's stock: the warehouse, what was counted, the version the counter saw and the reason (F10 AG-3644).",
                "properties": {
                    "warehouse": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "counted": {
                        "type": "string",
                        "pattern": "^\\d{1,11}(\\.\\d{1,3})?$"
                    },
                    "row_version": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "reason": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                        "minLength": 5,
                        "maxLength": 500
                    }
                },
                "required": [
                    "warehouse",
                    "counted",
                    "row_version",
                    "reason"
                ],
                "title": "CountStockRequest"
            },
            "CreateAssetRequest": {
                "type": "object",
                "description": "What a key may send to create a trailer or equipment: catalogue values by code, no lessor and no owner identity number, so only an owned or co-owned asset (F10 AG-3318).",
                "properties": {
                    "kind": {
                        "type": "string",
                        "enum": [
                            "trailer",
                            "equipment"
                        ]
                    },
                    "category_code": {
                        "type": "string",
                        "maxLength": 40
                    },
                    "asset_tag": {
                        "type": "string",
                        "maxLength": 60
                    },
                    "name": {
                        "type": "string",
                        "maxLength": 150
                    },
                    "make_code": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 100
                    },
                    "model_code": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 100
                    },
                    "manufacture_year": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "serial_number": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 60
                    },
                    "chassis_number": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 40
                    },
                    "plate_number": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 20
                    },
                    "ownership_type": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "owned",
                            "co_owned",
                            null
                        ]
                    },
                    "capacity_value": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "capacity_unit": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 20
                    },
                    "coupling_type": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 40
                    },
                    "gross_weight_kg": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "branch_uuid": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "uuid"
                    },
                    "notes": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 2000
                    }
                },
                "required": [
                    "kind",
                    "category_code",
                    "asset_tag",
                    "name"
                ],
                "title": "CreateAssetRequest"
            },
            "CreateBuyerRequest": {
                "type": "object",
                "description": "What a key sends to keep a buyer (F10 AG-3201): a name and optionally a phone; an identity number is not accepted over a key at all, in any field.",
                "properties": {
                    "name": {
                        "type": "string",
                        "maxLength": 200
                    },
                    "phone": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^\\+?[0-9 ]{6,}$",
                        "maxLength": 30
                    }
                },
                "required": [
                    "name"
                ],
                "title": "CreateBuyerRequest"
            },
            "CreateFuelCardRequest": {
                "type": "object",
                "description": "What a key sends to add a fuel card: the provider, the last four digits, optionally a name, a holder by uuid and a monthly limit; never the number or a note (F10 AG-2891).",
                "properties": {
                    "provider": {
                        "type": "string",
                        "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                        "maxLength": 60
                    },
                    "last4": {
                        "type": "string",
                        "pattern": "^[0-9]{4}$"
                    },
                    "label": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                        "maxLength": 60
                    },
                    "vehicle": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "uuid"
                    },
                    "driver": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "uuid"
                    },
                    "monthly_limit": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "minimum": 0
                    },
                    "currency": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[A-Z]{3}$"
                    }
                },
                "required": [
                    "provider",
                    "last4"
                ],
                "title": "CreateFuelCardRequest"
            },
            "CreateFuelLogRequest": {
                "type": "object",
                "description": "What a key sends to record a refuel of an engine tank: the vehicle by uuid, when, the litres and optionally the amount, the odometer and the station; never a driver, a receipt, a compartment or a review flag, and no card number in any field (F10 AG-3040).",
                "properties": {
                    "vehicle": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "filled_at": {
                        "type": "string"
                    },
                    "litres": {
                        "type": "string",
                        "pattern": "^\\d{1,9}(\\.\\d{1,3})?$"
                    },
                    "amount": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^\\d{1,9}(\\.\\d{1,3})?$"
                    },
                    "currency": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[A-Z]{3}$"
                    },
                    "odometer_km": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "minimum": 0,
                        "maximum": 9999999
                    },
                    "is_full_tank": {
                        "type": "boolean"
                    },
                    "station": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                        "maxLength": 200
                    },
                    "card": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "uuid"
                    }
                },
                "required": [
                    "vehicle",
                    "filled_at",
                    "litres",
                    "is_full_tank"
                ],
                "title": "CreateFuelLogRequest"
            },
            "CreateInspectionScheduleRequest": {
                "type": "object",
                "description": "What a key sends to create an inspection schedule: the vehicle, one checklist by its code or its uuid, and the days between two inspections; never a status or a start day.",
                "properties": {
                    "vehicle": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "checklist_code": {
                        "type": "string",
                        "pattern": "^[a-z0-9][a-z0-9_]{0,39}$"
                    },
                    "checklist_uuid": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "every_days": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 3650
                    }
                },
                "required": [
                    "vehicle",
                    "every_days"
                ],
                "title": "CreateInspectionScheduleRequest"
            },
            "CreatePlanRequest": {
                "type": "object",
                "description": "What a key sends to create a maintenance plan: the vehicle, the name and the plan's terms; never a template, a status or an amount of money (D214).",
                "properties": {
                    "vehicle": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "name": {
                        "type": "object",
                        "properties": {
                            "ar": {
                                "type": "string",
                                "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                                "maxLength": 100
                            },
                            "en": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                                "maxLength": 100
                            }
                        },
                        "required": [
                            "ar"
                        ]
                    },
                    "plan_type": {
                        "type": "string",
                        "maxLength": 20
                    },
                    "category": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 40
                    },
                    "every_km": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "every_days": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "every_hours": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "due_soon_km": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "due_soon_days": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "due_soon_hours": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "baseline_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date"
                    },
                    "baseline_km": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "baseline_hours": {
                        "type": [
                            "number",
                            "null"
                        ]
                    }
                },
                "required": [
                    "vehicle",
                    "name"
                ],
                "title": "CreatePlanRequest"
            },
            "DecideLeaveRequestRequest": {
                "type": "object",
                "description": "What a key sends to decide a leave request: nothing to approve, a reason from the fixed list to decline; nothing else.",
                "properties": {
                    "reason": {
                        "$ref": "#/components/schemas/LeaveDeclineReason"
                    },
                    "note": {
                        "type": "string"
                    }
                },
                "title": "DecideLeaveRequestRequest"
            },
            "DeclareCostRequest": {
                "type": "object",
                "description": "The body of an invoice declared by key: kind, who billed, the number, the day, and the amount and VAT in whole minor units.",
                "properties": {
                    "kind": {
                        "$ref": "#/components/schemas/CostKind"
                    },
                    "payee": {
                        "type": "string",
                        "minLength": 2,
                        "maxLength": 150
                    },
                    "invoice_number": {
                        "type": "string",
                        "maxLength": 60
                    },
                    "invoice_on": {
                        "type": "string",
                        "format": "date"
                    },
                    "amount_minor": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 999999999999
                    },
                    "vat_minor": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "minimum": 0,
                        "maximum": 999999999999
                    }
                },
                "required": [
                    "kind",
                    "payee",
                    "invoice_number",
                    "invoice_on",
                    "amount_minor"
                ],
                "title": "DeclareCostRequest"
            },
            "DismissDefectRequest": {
                "type": "object",
                "description": "What a key sends to dismiss a defect: the version it read and the reason, plain text; nothing else (F10 AG-2863).",
                "properties": {
                    "row_version": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "reason": {
                        "type": "string",
                        "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                        "minLength": 3,
                        "maxLength": 500
                    }
                },
                "required": [
                    "row_version",
                    "reason"
                ],
                "title": "DismissDefectRequest"
            },
            "DisposeVehicleRequest": {
                "type": "object",
                "description": "What a key sends to record the sale or scrapping of a vehicle (F10 AG-3201): the kind, the day, the price and its currency, a buyer kept by the company or a name, and a reference; never an identity number, a contract, a gain or a book value, which the server works out.",
                "properties": {
                    "kind": {
                        "type": "string",
                        "enum": [
                            "sale",
                            "scrap"
                        ]
                    },
                    "occurred_on": {
                        "type": "string",
                        "format": "date"
                    },
                    "amount": {
                        "type": "string",
                        "pattern": "^\\d{1,12}(\\.\\d{1,3})?$"
                    },
                    "currency": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[A-Za-z]{3}$",
                        "minLength": 3,
                        "maxLength": 3
                    },
                    "buyer_uuid": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "uuid"
                    },
                    "buyer_name": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 200
                    },
                    "reference": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 100
                    }
                },
                "required": [
                    "kind",
                    "occurred_on",
                    "amount"
                ],
                "title": "DisposeVehicleRequest"
            },
            "EndAssetAssignmentRequest": {
                "type": "object",
                "description": "The holding a key means to end and the reason it sends for ending it (F10 AG-3318, AG-4695); the reason holds no card or identity number.",
                "properties": {
                    "assignment_uuid": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "reason": {
                        "type": "string",
                        "minLength": 3,
                        "maxLength": 1000
                    }
                },
                "required": [
                    "assignment_uuid",
                    "reason"
                ],
                "title": "EndAssetAssignmentRequest"
            },
            "ExpenseTypeRequest": {
                "type": "object",
                "description": "What a key sends to add or rename an expense type of its company: the Arabic name, the English name when there is one and, on a change, whether the type is in use; nothing else.",
                "properties": {
                    "name_ar": {
                        "type": "string",
                        "maxLength": 120
                    },
                    "name_en": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 120
                    },
                    "is_active": {
                        "type": "boolean"
                    }
                },
                "required": [
                    "name_ar"
                ],
                "title": "ExpenseTypeRequest"
            },
            "FitItemRequest": {
                "type": "object",
                "description": "What a key sends to record a tyre or a battery fitted to a vehicle: the vehicle or the asset by uuid, what it is and where it sits; never a cost (money stays in the panel) and nothing else (F10 AG-2834).",
                "properties": {
                    "vehicle": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "asset": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "kind": {
                        "$ref": "#/components/schemas/FittedItemKind"
                    },
                    "brand": {
                        "type": "string",
                        "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                        "maxLength": 60
                    },
                    "model": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                        "maxLength": 60
                    },
                    "specification": {
                        "type": "string",
                        "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                        "maxLength": 60
                    },
                    "serial_number": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                        "maxLength": 40
                    },
                    "condition": {
                        "anyOf": [
                            {
                                "$ref": "#/components/schemas/TyreCondition"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "placement": {
                        "$ref": "#/components/schemas/FittedPlacement"
                    },
                    "axle": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 20
                    },
                    "side": {
                        "type": "string",
                        "enum": [
                            "left",
                            "right"
                        ]
                    },
                    "slot": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 20
                    },
                    "fitted_on": {
                        "type": "string",
                        "format": "date"
                    },
                    "fitted_km": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "minimum": 0
                    },
                    "tread_mm": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "minimum": 0
                    },
                    "cost": {
                        "type": "string"
                    },
                    "cost_minor": {
                        "type": "string"
                    }
                },
                "required": [
                    "kind",
                    "brand",
                    "specification",
                    "fitted_on"
                ],
                "title": "FitItemRequest"
            },
            "FittedItemKind": {
                "type": "string",
                "description": "What a fitted item is: a tyre or a battery.\n",
                "enum": [
                    "tyre",
                    "battery"
                ],
                "title": "FittedItemKind"
            },
            "FittedPlacement": {
                "type": "string",
                "description": "Where on a vehicle a fitted item sits: on a wheel, as a spare, or in a battery slot.\n",
                "enum": [
                    "wheel",
                    "spare",
                    "battery"
                ],
                "title": "FittedPlacement"
            },
            "FleetRuleStatus": {
                "type": "string",
                "description": "A rule watches while active, waits while paused, and is kept but never watches again once retired.\n",
                "enum": [
                    "active",
                    "paused",
                    "retired"
                ],
                "title": "FleetRuleStatus"
            },
            "GeofenceEventsRequest": {
                "type": "object",
                "description": "The body of a geofence events switch: on or off, and the row version read.",
                "properties": {
                    "enabled": {
                        "type": "boolean"
                    },
                    "row_version": {
                        "type": "integer",
                        "minimum": 1
                    }
                },
                "required": [
                    "enabled",
                    "row_version"
                ],
                "title": "GeofenceEventsRequest"
            },
            "GeofenceGroupRequest": {
                "type": "object",
                "description": "The body of a geofence group change: the new group name, or null to leave every group, and the row version read.",
                "properties": {
                    "group": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[^<>]*$",
                        "maxLength": 60
                    },
                    "row_version": {
                        "type": "integer",
                        "minimum": 1
                    }
                },
                "required": [
                    "group",
                    "row_version"
                ],
                "title": "GeofenceGroupRequest"
            },
            "GeofenceImportRequest": {
                "type": "object",
                "description": "The body of a geofence import: at most MAX_ZONES zones in the allow-listed shape of the write, one optional vehicle scope for the whole batch, and dry_run to check without writing.",
                "properties": {
                    "dry_run": {
                        "type": "boolean"
                    },
                    "zones": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "name": {
                                    "type": "object",
                                    "properties": {
                                        "ar": {
                                            "type": "string",
                                            "pattern": "^[^<>]*$",
                                            "maxLength": 120
                                        },
                                        "en": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "pattern": "^[^<>]*$",
                                            "maxLength": 120
                                        }
                                    },
                                    "required": [
                                        "ar"
                                    ]
                                },
                                "group": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "pattern": "^[^<>]*$",
                                    "maxLength": 60
                                },
                                "shape": {
                                    "$ref": "#/components/schemas/GeofenceShape"
                                },
                                "center_latitude": {
                                    "type": [
                                        "number",
                                        "null"
                                    ],
                                    "minimum": -90,
                                    "maximum": 90
                                },
                                "center_longitude": {
                                    "type": [
                                        "number",
                                        "null"
                                    ],
                                    "minimum": -180,
                                    "maximum": 180
                                },
                                "radius_m": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ],
                                    "minimum": 5,
                                    "maximum": 50000
                                },
                                "vertices": {
                                    "type": [
                                        "array",
                                        "null"
                                    ],
                                    "items": {
                                        "type": "object",
                                        "properties": {
                                            "latitude": {
                                                "type": "number",
                                                "minimum": -90,
                                                "maximum": 90
                                            },
                                            "longitude": {
                                                "type": "number",
                                                "minimum": -180,
                                                "maximum": 180
                                            }
                                        },
                                        "required": [
                                            "latitude",
                                            "longitude"
                                        ]
                                    },
                                    "maxItems": 1000
                                },
                                "planned_stops": {
                                    "type": [
                                        "array",
                                        "null"
                                    ],
                                    "items": {
                                        "type": "object",
                                        "properties": {
                                            "latitude": {
                                                "type": "number",
                                                "minimum": -90,
                                                "maximum": 90
                                            },
                                            "longitude": {
                                                "type": "number",
                                                "minimum": -180,
                                                "maximum": 180
                                            }
                                        },
                                        "required": [
                                            "latitude",
                                            "longitude"
                                        ]
                                    },
                                    "maxItems": 100
                                },
                                "dwell_limit_minutes": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ],
                                    "minimum": 1,
                                    "maximum": 10080
                                },
                                "stop_limit_minutes": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ],
                                    "minimum": 1,
                                    "maximum": 1440
                                },
                                "gps_tolerance_m": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ],
                                    "minimum": 1,
                                    "maximum": 50000
                                },
                                "fuel_drop_percent": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ],
                                    "minimum": 1,
                                    "maximum": 100
                                },
                                "fuel_drop_litres": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ],
                                    "minimum": 1,
                                    "maximum": 100000
                                },
                                "active_from": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "format": "date-time"
                                },
                                "active_until": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "format": "date-time"
                                }
                            },
                            "required": [
                                "name",
                                "shape"
                            ]
                        },
                        "minItems": 1,
                        "maxItems": 50
                    },
                    "scope": {
                        "type": "object",
                        "properties": {
                            "kind": {
                                "type": "string",
                                "enum": [
                                    "all",
                                    "refrigerated",
                                    "vehicles"
                                ]
                            },
                            "vehicle_uuids": {
                                "type": "array",
                                "items": {
                                    "type": "string",
                                    "format": "uuid"
                                },
                                "minItems": 1,
                                "maxItems": 500,
                                "uniqueItems": true
                            }
                        }
                    }
                },
                "required": [
                    "dry_run",
                    "zones"
                ],
                "title": "GeofenceImportRequest"
            },
            "GeofenceShape": {
                "type": "string",
                "description": "A geofence is a circle around a point or a simple polygon (FLEET-RULES A.3).\n",
                "enum": [
                    "circle",
                    "polygon",
                    "corridor"
                ],
                "title": "GeofenceShape"
            },
            "GeofenceStatusRequest": {
                "type": "object",
                "description": "The body of a geofence state change: the new state and the row version read with the geofence.",
                "properties": {
                    "status": {
                        "$ref": "#/components/schemas/FleetRuleStatus"
                    },
                    "row_version": {
                        "type": "integer",
                        "minimum": 1
                    }
                },
                "required": [
                    "status",
                    "row_version"
                ],
                "title": "GeofenceStatusRequest"
            },
            "GeofenceWriteRequest": {
                "type": "object",
                "description": "The body of a geofence create or full replacement: the shared allow-list, the row version a replacement was read at, and an optional vehicle scope by public uuids.",
                "properties": {
                    "row_version": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "name": {
                        "type": "object",
                        "properties": {
                            "ar": {
                                "type": "string",
                                "pattern": "^[^<>]*$",
                                "maxLength": 120
                            },
                            "en": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "pattern": "^[^<>]*$",
                                "maxLength": 120
                            }
                        },
                        "required": [
                            "ar"
                        ]
                    },
                    "group": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[^<>]*$",
                        "maxLength": 60
                    },
                    "shape": {
                        "$ref": "#/components/schemas/GeofenceShape"
                    },
                    "center_latitude": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "minimum": -90,
                        "maximum": 90
                    },
                    "center_longitude": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "minimum": -180,
                        "maximum": 180
                    },
                    "radius_m": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "minimum": 5,
                        "maximum": 50000
                    },
                    "vertices": {
                        "type": [
                            "array",
                            "null"
                        ],
                        "items": {
                            "type": "object",
                            "properties": {
                                "latitude": {
                                    "type": "number",
                                    "minimum": -90,
                                    "maximum": 90
                                },
                                "longitude": {
                                    "type": "number",
                                    "minimum": -180,
                                    "maximum": 180
                                }
                            },
                            "required": [
                                "latitude",
                                "longitude"
                            ]
                        },
                        "maxItems": 1000
                    },
                    "planned_stops": {
                        "type": [
                            "array",
                            "null"
                        ],
                        "items": {
                            "type": "object",
                            "properties": {
                                "latitude": {
                                    "type": "number",
                                    "minimum": -90,
                                    "maximum": 90
                                },
                                "longitude": {
                                    "type": "number",
                                    "minimum": -180,
                                    "maximum": 180
                                }
                            },
                            "required": [
                                "latitude",
                                "longitude"
                            ]
                        },
                        "maxItems": 100
                    },
                    "dwell_limit_minutes": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "minimum": 1,
                        "maximum": 10080
                    },
                    "stop_limit_minutes": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "minimum": 1,
                        "maximum": 1440
                    },
                    "gps_tolerance_m": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "minimum": 1,
                        "maximum": 50000
                    },
                    "fuel_drop_percent": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "minimum": 1,
                        "maximum": 100
                    },
                    "fuel_drop_litres": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "minimum": 1,
                        "maximum": 100000
                    },
                    "active_from": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "active_until": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "scope": {
                        "type": "object",
                        "properties": {
                            "kind": {
                                "type": "string",
                                "enum": [
                                    "all",
                                    "refrigerated",
                                    "vehicles"
                                ]
                            },
                            "vehicle_uuids": {
                                "type": "array",
                                "items": {
                                    "type": "string",
                                    "format": "uuid"
                                },
                                "minItems": 1,
                                "maxItems": 500,
                                "uniqueItems": true
                            }
                        }
                    }
                },
                "required": [
                    "name",
                    "shape"
                ],
                "title": "GeofenceWriteRequest"
            },
            "HandoverRecordState": {
                "type": "string",
                "description": "Where a handover record stands, read from what is recorded on it.\n",
                "enum": [
                    "awaiting_inspection",
                    "awaiting_outgoing",
                    "awaiting_incoming",
                    "complete"
                ],
                "title": "HandoverRecordState"
            },
            "InspectionScheduleStatusRequest": {
                "type": "object",
                "description": "What a key sends to pause, resume or end an inspection schedule: the version it read; ending, which cannot be undone, also needs confirm set to true.",
                "properties": {
                    "row_version": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "confirm": {
                        "type": "string"
                    }
                },
                "required": [
                    "row_version"
                ],
                "title": "InspectionScheduleStatusRequest"
            },
            "IssuePartRequest": {
                "type": "object",
                "description": "What a key sends to issue a part to a work order: the part, the warehouse and a quantity as a decimal string of at most three places (Arabic digits are read as digits); never a price, a cost or a currency (F10 AG-2961).",
                "properties": {
                    "part": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "warehouse": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "quantity": {
                        "type": "string",
                        "pattern": "^\\d{1,11}(\\.\\d{1,3})?$"
                    }
                },
                "required": [
                    "part",
                    "warehouse",
                    "quantity"
                ],
                "title": "IssuePartRequest"
            },
            "LeaveDeclineReason": {
                "type": "string",
                "description": "The three reasons a manager may give when declining a leave request; a fixed list, never free text (F10 AG-3091).\n",
                "enum": [
                    "period_not_possible",
                    "balance_used",
                    "other_reason"
                ],
                "title": "LeaveDeclineReason"
            },
            "ObjectViolationRequest": {
                "type": "object",
                "description": "What a key sends to record an objection to a violation: the version it read, the day it was lodged and why.",
                "properties": {
                    "row_version": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "day": {
                        "type": "string",
                        "format": "date"
                    },
                    "reason": {
                        "type": "string",
                        "maxLength": 1000
                    }
                },
                "required": [
                    "row_version",
                    "day",
                    "reason"
                ],
                "title": "ObjectViolationRequest"
            },
            "OpenCaseRequest": {
                "type": "object",
                "description": "The body of a case opened by key: the vehicle, what is wrong, whether it can move, a note and an optional position.",
                "properties": {
                    "vehicle_uuid": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "symptom": {
                        "$ref": "#/components/schemas/CaseSymptom"
                    },
                    "can_move": {
                        "anyOf": [
                            {
                                "$ref": "#/components/schemas/CanMove"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "note": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 500
                    },
                    "lat": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "minimum": -90,
                        "maximum": 90
                    },
                    "lng": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "minimum": -180,
                        "maximum": 180
                    }
                },
                "required": [
                    "vehicle_uuid",
                    "symptom"
                ],
                "title": "OpenCaseRequest"
            },
            "OpenWorkOrderRequest": {
                "type": "object",
                "description": "What a key may send to open a work order: the vehicle, what is wrong, its type and category and, for a breakdown, whether the vehicle stopped; never an amount of money or a part (F10 AG-2782); the workshop is named by its uuid from the places list, never by a number (D422).",
                "properties": {
                    "vehicle": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "summary": {
                        "type": "string",
                        "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                        "minLength": 3,
                        "maxLength": 200
                    },
                    "notes": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                        "maxLength": 2000
                    },
                    "plan": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "uuid"
                    },
                    "facility": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "uuid"
                    },
                    "maintenance_type": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "scheduled",
                            "preventive",
                            "corrective",
                            "predictive",
                            null
                        ]
                    },
                    "category": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 40
                    },
                    "cause": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 40
                    },
                    "kept_running": {
                        "type": [
                            "boolean",
                            "null"
                        ]
                    },
                    "out_of_service_at": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "expected_done_on": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date"
                    },
                    "cost": {
                        "type": "string"
                    },
                    "labour_cost": {
                        "type": "string"
                    },
                    "parts_cost": {
                        "type": "string"
                    },
                    "amount": {
                        "type": "string"
                    },
                    "total": {
                        "type": "string"
                    },
                    "facility_id": {
                        "type": "string"
                    },
                    "parts": {
                        "type": "string"
                    }
                },
                "required": [
                    "vehicle",
                    "summary"
                ],
                "title": "OpenWorkOrderRequest"
            },
            "PayViolationRequest": {
                "type": "object",
                "description": "What a key sends to mark a violation paid: the row version it read, the day, the amount and who paid; no receipt file and no expense link.",
                "properties": {
                    "row_version": {
                        "type": "integer",
                        "minimum": 0
                    },
                    "paid_on": {
                        "type": "string",
                        "format": "date"
                    },
                    "amount": {
                        "type": "string",
                        "pattern": "^\\d{1,12}(\\.\\d{1,3})?$"
                    },
                    "paid_by": {
                        "type": "string",
                        "enum": [
                            "company",
                            "driver"
                        ]
                    },
                    "difference_note": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 300
                    }
                },
                "required": [
                    "row_version",
                    "paid_on",
                    "amount",
                    "paid_by"
                ],
                "title": "PayViolationRequest"
            },
            "PlanStatusRequest": {
                "type": "object",
                "description": "What a key sends to pause, resume or retire a maintenance plan: the version it read; retiring, which cannot be undone, also needs confirm set to true (D214).",
                "properties": {
                    "row_version": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "confirm": {
                        "type": "string"
                    }
                },
                "required": [
                    "row_version"
                ],
                "title": "PlanStatusRequest"
            },
            "ProfitCompare": {
                "type": "string",
                "description": "What a period is compared with: the stretch just before it, or the same days a year earlier.\n",
                "enum": [
                    "previous",
                    "year_before"
                ],
                "title": "ProfitCompare"
            },
            "ProposeDriverRequest": {
                "type": "object",
                "description": "What a key may send to propose a driver: the name in Arabic and English, nothing else; any other key is refused by its name (FG-14 part B, F10 AG-4660).",
                "properties": {
                    "full_name": {
                        "type": "object",
                        "properties": {
                            "ar": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                                "maxLength": 150
                            },
                            "en": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                                "maxLength": 150
                            }
                        }
                    }
                },
                "required": [
                    "full_name"
                ],
                "title": "ProposeDriverRequest"
            },
            "ProposePayLedgerEntryRequest": {
                "type": "object",
                "description": "What a key may send to propose a pay ledger entry: the driver by uuid, the kind, an amount in minor units within the ceiling, the currency, the instalment of an advance, a reason code and a note; a card number in any field is refused and never repeated.",
                "properties": {
                    "driver": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "kind": {
                        "type": "string",
                        "enum": [
                            "advance",
                            "deduction",
                            "addition"
                        ]
                    },
                    "amount_minor": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 5000000
                    },
                    "currency": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "minLength": 3,
                        "maxLength": 3
                    },
                    "instalment_minor": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "minimum": 1,
                        "maximum": 5000000
                    },
                    "reason_code": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "traffic_fine",
                            "accident",
                            "damage",
                            "shortage",
                            "absence",
                            "bonus",
                            "other",
                            null
                        ]
                    },
                    "note": {
                        "type": "string",
                        "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                        "maxLength": 1000
                    },
                    "driver_id": {
                        "type": "string"
                    },
                    "company_id": {
                        "type": "string"
                    },
                    "branch_id": {
                        "type": "string"
                    },
                    "state": {
                        "type": "string"
                    }
                },
                "required": [
                    "driver",
                    "kind",
                    "amount_minor",
                    "note"
                ],
                "title": "ProposePayLedgerEntryRequest"
            },
            "ProposePerDiemRateRequest": {
                "type": "object",
                "description": "What a key may send to propose a per diem rate: the activity, the start day, the amount in minor units, the currency and a reason; a card number in any field is refused and never repeated.",
                "properties": {
                    "activity": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 60
                    },
                    "effective_from": {
                        "type": "string",
                        "format": "date"
                    },
                    "amount_minor": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 10000000000
                    },
                    "currency": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "minLength": 3,
                        "maxLength": 3
                    },
                    "reason": {
                        "type": "string",
                        "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                        "maxLength": 1000
                    },
                    "company_id": {
                        "type": "string"
                    },
                    "state": {
                        "type": "string"
                    }
                },
                "required": [
                    "effective_from",
                    "amount_minor",
                    "reason"
                ],
                "title": "ProposePerDiemRateRequest"
            },
            "ProposeSwapRequest": {
                "type": "object",
                "description": "The body of a head swap proposed by key: the replacement tractor, who drives, and the caller's own confirmation of the lines marked unknown.",
                "properties": {
                    "to_vehicle_uuid": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "driver_mode": {
                        "$ref": "#/components/schemas/SwapDriverMode"
                    },
                    "confirm_compatibility": {
                        "type": [
                            "boolean",
                            "null"
                        ]
                    }
                },
                "required": [
                    "to_vehicle_uuid",
                    "driver_mode"
                ],
                "title": "ProposeSwapRequest"
            },
            "RateCaseRequest": {
                "type": "object",
                "description": "The body of a rating given by key: the stars, the four optional aspects and a short comment.",
                "properties": {
                    "stars": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 5
                    },
                    "arrival": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "minimum": 1,
                        "maximum": 5
                    },
                    "quality": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "minimum": 1,
                        "maximum": 5
                    },
                    "price": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "minimum": 1,
                        "maximum": 5
                    },
                    "communication": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "minimum": 1,
                        "maximum": 5
                    },
                    "comment": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 500
                    }
                },
                "required": [
                    "stars"
                ],
                "title": "RateCaseRequest"
            },
            "ReceiveStockRequest": {
                "type": "object",
                "description": "Stock received into one warehouse: the warehouse, a quantity, the unit price and an optional supplier reference (F10 AG-3644).",
                "properties": {
                    "warehouse": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "quantity": {
                        "type": "string",
                        "pattern": "^\\d{1,11}(\\.\\d{1,3})?$"
                    },
                    "unit_cost": {
                        "type": "string",
                        "pattern": "^\\d{1,10}(\\.\\d{1,4})?$"
                    },
                    "reference": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                        "maxLength": 100
                    }
                },
                "required": [
                    "warehouse",
                    "quantity",
                    "unit_cost"
                ],
                "title": "ReceiveStockRequest"
            },
            "RecordAccidentRequest": {
                "type": "object",
                "description": "What a key sends to record an accident: the vehicle, when, optionally where on the map, the kind of other party and the share of fault; never the other party, the driver, the notes, the report or claim numbers, the injury class or a file (F10 AG-3129).",
                "properties": {
                    "vehicle": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "occurred_at": {
                        "type": "string"
                    },
                    "lat": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "minimum": -90,
                        "maximum": 90
                    },
                    "lng": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "minimum": -180,
                        "maximum": 180
                    },
                    "party_kind": {
                        "type": "string",
                        "enum": [
                            "vehicle",
                            "property",
                            "none"
                        ]
                    },
                    "liability_quarters": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "minimum": 0,
                        "maximum": 4
                    }
                },
                "required": [
                    "vehicle",
                    "occurred_at",
                    "party_kind"
                ],
                "title": "RecordAccidentRequest"
            },
            "RecordExpenseRequest": {
                "type": "object",
                "description": "What a key may send to record a vehicle expense: the vehicle, type, day, amount in minor units, currency and the supplier, reference and note; never a driver, a receipt or a file (a fine has no driver, F10 AG-1774).",
                "properties": {
                    "vehicle": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "expense_type_code": {
                        "type": "string",
                        "maxLength": 40
                    },
                    "spent_on": {
                        "type": "string",
                        "format": "date"
                    },
                    "amount_minor": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 10000000000000
                    },
                    "currency": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "minLength": 3,
                        "maxLength": 3
                    },
                    "supplier": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                        "maxLength": 200
                    },
                    "reference": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                        "maxLength": 100
                    },
                    "note": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                        "maxLength": 1000
                    },
                    "driver": {
                        "type": "string"
                    },
                    "driver_id": {
                        "type": "string"
                    },
                    "receipt": {
                        "type": "string"
                    },
                    "company_id": {
                        "type": "string"
                    },
                    "branch_id": {
                        "type": "string"
                    }
                },
                "required": [
                    "vehicle",
                    "expense_type_code",
                    "spent_on",
                    "amount_minor"
                ],
                "title": "RecordExpenseRequest"
            },
            "RecordIncomeRequest": {
                "type": "object",
                "description": "What a key may send to record a vehicle income: the vehicle, type, day, amount in minor units, currency and the payer, reference and note; never a driver or a file.",
                "properties": {
                    "vehicle": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "income_type_code": {
                        "type": "string",
                        "maxLength": 40
                    },
                    "earned_on": {
                        "type": "string",
                        "format": "date"
                    },
                    "amount_minor": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 10000000000000
                    },
                    "currency": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "minLength": 3,
                        "maxLength": 3
                    },
                    "payer": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                        "maxLength": 200
                    },
                    "reference": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                        "maxLength": 100
                    },
                    "note": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                        "maxLength": 1000
                    },
                    "driver": {
                        "type": "string"
                    },
                    "document": {
                        "type": "string"
                    },
                    "company_id": {
                        "type": "string"
                    },
                    "branch_id": {
                        "type": "string"
                    }
                },
                "required": [
                    "vehicle",
                    "income_type_code",
                    "earned_on",
                    "amount_minor"
                ],
                "title": "RecordIncomeRequest"
            },
            "RecordLifecycleStageRequest": {
                "type": "object",
                "description": "What a key sends to record a purchase or an in-service stage of a vehicle: the stage, its day, an optional note, and for a purchase the seller, reference, amount and currency; never a sale, a scrapping or a retirement, a buyer or an identity\nnumber (F10 AG-2941). Arabic digits in the amount are read as digits, every free-text field is refused when it holds a card number, and every key the rules do not name is refused.",
                "properties": {
                    "stage": {
                        "type": "string",
                        "enum": [
                            "acquired",
                            "in_service"
                        ]
                    },
                    "occurred_on": {
                        "type": "string",
                        "format": "date"
                    },
                    "note": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 500
                    },
                    "seller": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 200
                    },
                    "reference": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 200
                    },
                    "amount": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^\\d{1,12}(\\.\\d{1,3})?$"
                    },
                    "currency": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[A-Za-z]{3}$",
                        "minLength": 3,
                        "maxLength": 3
                    }
                },
                "required": [
                    "stage",
                    "occurred_on"
                ],
                "title": "RecordLifecycleStageRequest"
            },
            "RecordOdometerReadingRequest": {
                "type": "object",
                "description": "What a key sends to record a manual odometer reading: the kilometres (Arabic digits are read as digits, anything unreadable is refused), when it was read and an optional note; never a source, a reference or a vehicle in the body (F10 AG-2835).",
                "properties": {
                    "km": {
                        "type": "number",
                        "pattern": "^\\d{1,7}(\\.\\d{1,3})?$",
                        "minimum": 0,
                        "maximum": 9999999.9
                    },
                    "read_at": {
                        "type": "string"
                    },
                    "note": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 600
                    },
                    "source": {
                        "type": "string"
                    },
                    "reference": {
                        "type": "string"
                    },
                    "vehicle": {
                        "type": "string"
                    }
                },
                "required": [
                    "km",
                    "read_at"
                ],
                "title": "RecordOdometerReadingRequest"
            },
            "RecordViolationRequest": {
                "type": "object",
                "description": "What a key sends to record a violation: the vehicle by uuid and the eight values; no driver, place, ticket file or receipt.",
                "properties": {
                    "vehicle": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "number": {
                        "type": "string",
                        "maxLength": 60
                    },
                    "authority": {
                        "type": "string",
                        "maxLength": 40
                    },
                    "type": {
                        "type": "string",
                        "maxLength": 40
                    },
                    "occurred_at": {
                        "type": "string"
                    },
                    "amount": {
                        "type": "string",
                        "pattern": "^\\d{1,12}(\\.\\d{1,3})?$"
                    },
                    "currency": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "minLength": 3,
                        "maxLength": 3
                    },
                    "due_on": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date"
                    }
                },
                "required": [
                    "vehicle",
                    "number",
                    "authority",
                    "type",
                    "occurred_at",
                    "amount"
                ],
                "title": "RecordViolationRequest"
            },
            "RefuseSwapRequest": {
                "type": "object",
                "description": "The body of a head swap refused by key: the reason, plain text.",
                "properties": {
                    "note": {
                        "type": "string",
                        "maxLength": 500
                    }
                },
                "required": [
                    "note"
                ],
                "title": "RefuseSwapRequest"
            },
            "RegisterVehicleRequest": {
                "type": "object",
                "description": "What a key sends to register a road vehicle: its sequence number, plate, plate type and legal operator, and optionally the catalogue make and model by code, the type code, the VIN and the year.",
                "properties": {
                    "sequence_number": {
                        "type": "string",
                        "maxLength": 20
                    },
                    "plate_number": {
                        "type": "string",
                        "maxLength": 8
                    },
                    "plate_right_letter": {
                        "type": "string",
                        "maxLength": 2
                    },
                    "plate_middle_letter": {
                        "type": "string",
                        "maxLength": 2
                    },
                    "plate_left_letter": {
                        "type": "string",
                        "maxLength": 2
                    },
                    "plate_type": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 99
                    },
                    "legal_operator_uuid": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "vin": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 17
                    },
                    "manufacture_year": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "vehicle_type_code": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 60
                    },
                    "make_code": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 60
                    },
                    "model_code": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 60
                    }
                },
                "required": [
                    "sequence_number",
                    "plate_number",
                    "plate_right_letter",
                    "plate_middle_letter",
                    "plate_left_letter",
                    "plate_type",
                    "legal_operator_uuid"
                ],
                "title": "RegisterVehicleRequest"
            },
            "RemovalReason": {
                "type": "string",
                "description": "Why a fitted item came off the vehicle; a closed list, with a note required for «other».\n",
                "enum": [
                    "worn_out",
                    "damaged",
                    "failed",
                    "aged",
                    "warranty",
                    "sold_or_scrapped",
                    "other"
                ],
                "title": "RemovalReason"
            },
            "RemoveItemRequest": {
                "type": "object",
                "description": "What a key sends to take a fitted item off a vehicle: the version it read, the day, the reason and optionally a note, the odometer and the last tread; voiding stays with the staff (F10 AG-2834).",
                "properties": {
                    "row_version": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "removed_on": {
                        "type": "string",
                        "format": "date"
                    },
                    "reason": {
                        "$ref": "#/components/schemas/RemovalReason"
                    },
                    "note": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                        "maxLength": 300
                    },
                    "odometer_km": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "minimum": 0
                    },
                    "tread_mm": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "minimum": 0
                    },
                    "cost": {
                        "type": "string"
                    }
                },
                "required": [
                    "row_version",
                    "removed_on",
                    "reason"
                ],
                "title": "RemoveItemRequest"
            },
            "ReopenViolationPaymentRequest": {
                "type": "object",
                "description": "What a key sends to reopen the payment of a violation: the version it read and why; nothing else.",
                "properties": {
                    "row_version": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "reason": {
                        "type": "string",
                        "maxLength": 1000
                    }
                },
                "required": [
                    "row_version",
                    "reason"
                ],
                "title": "ReopenViolationPaymentRequest"
            },
            "ReorderLevelRequest": {
                "type": "object",
                "description": "The reorder level of one warehouse's stock, at the version the sender saw (F10 AG-3644).",
                "properties": {
                    "warehouse": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "reorder_level": {
                        "type": "string",
                        "pattern": "^\\d{1,11}(\\.\\d{1,3})?$"
                    },
                    "row_version": {
                        "type": "integer",
                        "minimum": 1
                    }
                },
                "required": [
                    "warehouse",
                    "reorder_level",
                    "row_version"
                ],
                "title": "ReorderLevelRequest"
            },
            "ReportDefectRequest": {
                "type": "object",
                "description": "What a key sends to report a defect: the vehicle, a title, the severity and optionally a description and a category code, all plain text; never a driver, an inspection, a source or an amount of money (F10 AG-2863).",
                "properties": {
                    "vehicle": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "title": {
                        "type": "string",
                        "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                        "minLength": 3,
                        "maxLength": 200
                    },
                    "severity": {
                        "type": "string",
                        "enum": [
                            "minor",
                            "major",
                            "critical"
                        ]
                    },
                    "description": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                        "maxLength": 1000
                    },
                    "category": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 40
                    }
                },
                "required": [
                    "vehicle",
                    "title",
                    "severity"
                ],
                "title": "ReportDefectRequest"
            },
            "RestoreAssetRequest": {
                "type": "object",
                "description": "The only field a key sends to restore an archived trailer or equipment: the row version it read (F10 AG-3318).",
                "properties": {
                    "row_version": {
                        "type": "integer",
                        "minimum": 1
                    }
                },
                "required": [
                    "row_version"
                ],
                "title": "RestoreAssetRequest"
            },
            "RetireFuelCardRequest": {
                "type": "object",
                "description": "What a key sends to stop a card or mark it lost: the version it read, the state and confirm=true, because it is final (F10 AG-2891).",
                "properties": {
                    "row_version": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "state": {
                        "type": "string",
                        "enum": [
                            "stopped",
                            "lost"
                        ]
                    },
                    "confirm": {
                        "enum": [
                            "yes",
                            "on",
                            "1",
                            1,
                            "true",
                            true
                        ]
                    }
                },
                "required": [
                    "row_version",
                    "state",
                    "confirm"
                ],
                "title": "RetireFuelCardRequest"
            },
            "RetractCostRequest": {
                "type": "object",
                "description": "The body of an invoice retraction by key: the reason, plain text.",
                "properties": {
                    "reason": {
                        "type": "string",
                        "maxLength": 500
                    }
                },
                "required": [
                    "reason"
                ],
                "title": "RetractCostRequest"
            },
            "ReturnPartRequest": {
                "type": "object",
                "description": "What a key sends to return a part to the warehouse it came from: a quantity as a decimal string of at most three places and an optional plain reason that holds no card number; never a price or a warehouse (F10 AG-2961).",
                "properties": {
                    "quantity": {
                        "type": "string",
                        "pattern": "^\\d{1,11}(\\.\\d{1,3})?$"
                    },
                    "reason": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                        "maxLength": 500
                    }
                },
                "required": [
                    "quantity"
                ],
                "title": "ReturnPartRequest"
            },
            "ReviewFuelLogRequest": {
                "type": "object",
                "description": "What a key sends to answer a refuel's review: the row version it read, the outcome and a note; nothing else.",
                "properties": {
                    "row_version": {
                        "type": "integer",
                        "minimum": 0
                    },
                    "outcome": {
                        "type": "string",
                        "enum": [
                            "correct",
                            "entry_error",
                            "follow_up"
                        ]
                    },
                    "note": {
                        "type": "string",
                        "minLength": 3,
                        "maxLength": 500
                    }
                },
                "required": [
                    "row_version",
                    "outcome",
                    "note"
                ],
                "title": "ReviewFuelLogRequest"
            },
            "ReworkWorkOrderRequest": {
                "type": "object",
                "description": "What a key sends to return a finished repair to the workshop: the version it read and the reason, free of a card number; nothing else (F10 AG-2996).",
                "properties": {
                    "row_version": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "reason": {
                        "type": "string",
                        "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                        "minLength": 10,
                        "maxLength": 500
                    },
                    "cost": {
                        "type": "string"
                    },
                    "labour_cost": {
                        "type": "string"
                    },
                    "amount": {
                        "type": "string"
                    }
                },
                "required": [
                    "row_version",
                    "reason"
                ],
                "title": "ReworkWorkOrderRequest"
            },
            "RotateItemsRequest": {
                "type": "object",
                "description": "What a key sends to move tyres of one vehicle or asset to new places at once, a swap included: each move names the item, the version read and the new place (F10 AG-2834).",
                "properties": {
                    "vehicle": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "asset": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "occurred_on": {
                        "type": "string",
                        "format": "date"
                    },
                    "odometer_km": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "minimum": 0
                    },
                    "moves": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "item": {
                                    "type": "string",
                                    "format": "uuid"
                                },
                                "row_version": {
                                    "type": "integer",
                                    "minimum": 1
                                },
                                "placement": {
                                    "$ref": "#/components/schemas/FittedPlacement"
                                },
                                "axle": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 20
                                },
                                "side": {
                                    "type": "string",
                                    "enum": [
                                        "left",
                                        "right"
                                    ]
                                },
                                "slot": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 20
                                }
                            },
                            "required": [
                                "item",
                                "row_version"
                            ]
                        },
                        "minItems": 1,
                        "maxItems": 24
                    },
                    "cost": {
                        "type": "string"
                    }
                },
                "required": [
                    "occurred_on",
                    "moves"
                ],
                "title": "RotateItemsRequest"
            },
            "SetDepreciationPlanRequest": {
                "type": "object",
                "description": "What a key sends to set the depreciation plan of a vehicle: the method, the money as decimals in the currency's major unit, the day of purchase and the parameter of the method; the panel's writer judges the figures (F10 AG-2941).",
                "properties": {
                    "method": {
                        "type": "string",
                        "enum": [
                            "straight_line",
                            "declining_balance",
                            "per_km"
                        ]
                    },
                    "cost": {
                        "type": "string",
                        "pattern": "^\\d{1,12}(\\.\\d{1,3})?$"
                    },
                    "salvage": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^\\d{1,12}(\\.\\d{1,3})?$"
                    },
                    "currency": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[A-Za-z]{3}$",
                        "minLength": 3,
                        "maxLength": 3
                    },
                    "acquired_on": {
                        "type": "string",
                        "format": "date"
                    },
                    "life_months": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "rate_percent": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^\\d{1,12}(\\.\\d{1,3})?$"
                    },
                    "total_km": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "start_km": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "replace_reason": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 255
                    }
                },
                "required": [
                    "method",
                    "cost",
                    "acquired_on"
                ],
                "title": "SetDepreciationPlanRequest"
            },
            "SparePartRequest": {
                "type": "object",
                "description": "What a key sends to define or change a spare part: the number, name, category, unit, minimum reorder level and, on creation, the currency; a plain-text name and number, never a price (D214).",
                "properties": {
                    "part_number": {
                        "type": "string",
                        "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                        "maxLength": 100
                    },
                    "name": {
                        "type": "string",
                        "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                        "maxLength": 250
                    },
                    "category": {
                        "type": "string",
                        "pattern": "^[a-z0-9_]+$",
                        "maxLength": 64
                    },
                    "unit_of_measure": {
                        "type": "string",
                        "enum": [
                            "piece",
                            "set",
                            "litre",
                            "kg",
                            "meter"
                        ]
                    },
                    "min_reorder_level": {
                        "type": "string",
                        "pattern": "^\\d{1,11}(\\.\\d{1,3})?$"
                    },
                    "currency": {
                        "type": "string",
                        "pattern": "^[A-Za-z]{3}$"
                    },
                    "row_version": {
                        "type": "integer",
                        "minimum": 1
                    }
                },
                "required": [
                    "row_version"
                ],
                "title": "SparePartRequest"
            },
            "SparePartStatusRequest": {
                "type": "object",
                "description": "What a key sends to discontinue a spare part or bring it back: the version it read (D214).",
                "properties": {
                    "row_version": {
                        "type": "integer",
                        "minimum": 1
                    }
                },
                "required": [
                    "row_version"
                ],
                "title": "SparePartStatusRequest"
            },
            "SupplierInputRequest": {
                "type": "object",
                "description": "What a key sends to add a supplier or to change one: the name, the kind and optionally the tax number, and for a change the version it read; a contact person, phone, email or note is never accepted over a key (T-259 slice 1d).",
                "properties": {
                    "name": {
                        "type": "string",
                        "maxLength": 150
                    },
                    "kind": {
                        "type": "string",
                        "enum": [
                            "parts",
                            "tyres",
                            "workshop",
                            "other"
                        ]
                    },
                    "tax_number": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 15
                    },
                    "row_version": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "contact_name": {
                        "type": "string"
                    },
                    "phone": {
                        "type": "string"
                    },
                    "email": {
                        "type": "string"
                    },
                    "note": {
                        "type": "string"
                    }
                },
                "required": [
                    "name",
                    "kind"
                ],
                "title": "SupplierInputRequest"
            },
            "SupplierVersionRequest": {
                "type": "object",
                "description": "What a key sends to archive or restore a supplier: only the version it read (T-259 slice 1d).",
                "properties": {
                    "row_version": {
                        "type": "integer",
                        "minimum": 1
                    }
                },
                "required": [
                    "row_version"
                ],
                "title": "SupplierVersionRequest"
            },
            "SwapDriverMode": {
                "type": "string",
                "description": "Who drives the new head: the driver of the broken one moves to it, or the new head's own driver takes the trip.\n",
                "enum": [
                    "same_driver_moves",
                    "new_head_driver"
                ],
                "title": "SwapDriverMode"
            },
            "TransferStockRequest": {
                "type": "object",
                "description": "Stock moved between two of the company's warehouses, with the reason (F10 AG-3644).",
                "properties": {
                    "from": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "to": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "quantity": {
                        "type": "string",
                        "pattern": "^\\d{1,11}(\\.\\d{1,3})?$"
                    },
                    "reason": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                        "minLength": 5,
                        "maxLength": 500
                    }
                },
                "required": [
                    "from",
                    "to",
                    "quantity",
                    "reason"
                ],
                "title": "TransferStockRequest"
            },
            "TripDelayExcuseRequest": {
                "type": "object",
                "description": "What a key sends to excuse or revoke a trip's delay: one written reason; any other key is refused.",
                "properties": {
                    "reason": {
                        "type": "string",
                        "minLength": 20,
                        "maxLength": 500
                    }
                },
                "required": [
                    "reason"
                ],
                "title": "TripDelayExcuseRequest"
            },
            "TripDriverMessageRequest": {
                "type": "object",
                "description": "What a key sends to write to a trip's driver: one plain-text body; any other key is refused (F10 AG-2827 style).",
                "properties": {
                    "body": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                    }
                },
                "required": [
                    "body"
                ],
                "title": "TripDriverMessageRequest"
            },
            "TyreCondition": {
                "type": "string",
                "description": "The state a tyre was in when it was fitted.\n",
                "enum": [
                    "new",
                    "retreaded",
                    "used"
                ],
                "title": "TyreCondition"
            },
            "UpdateAccidentClaimRequest": {
                "type": "object",
                "description": "What a key sends to update the claim of an accident: the row version it read, the claim state, the currency and the amounts as text decimals (Arabic digits are read as Latin ones); never a claim number or a file; the writer's rules on accepted and received apply (F10 AG-3129).",
                "properties": {
                    "row_version": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "claim_state": {
                        "type": "string",
                        "enum": [
                            "none",
                            "under_review",
                            "accepted",
                            "accepted_partly",
                            "rejected",
                            "received"
                        ]
                    },
                    "currency": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "minLength": 3,
                        "maxLength": 3
                    },
                    "claimed": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[0-9]+(\\.[0-9]{1,3})?$",
                        "maxLength": 30
                    },
                    "accepted": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[0-9]+(\\.[0-9]{1,3})?$",
                        "maxLength": 30
                    },
                    "received": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[0-9]+(\\.[0-9]{1,3})?$",
                        "maxLength": 30
                    },
                    "received_on": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date"
                    }
                },
                "required": [
                    "row_version",
                    "claim_state"
                ],
                "title": "UpdateAccidentClaimRequest"
            },
            "UpdateAssetRequest": {
                "type": "object",
                "description": "What a key may send to edit a trailer or equipment: the row version it read (a stale one answers 409) and any of the fields it may change; the kind never changes (F10 AG-3318).",
                "properties": {
                    "row_version": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "category_code": {
                        "type": "string",
                        "maxLength": 40
                    },
                    "asset_tag": {
                        "type": "string",
                        "maxLength": 60
                    },
                    "name": {
                        "type": "string",
                        "maxLength": 150
                    },
                    "make_code": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 100
                    },
                    "model_code": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 100
                    },
                    "manufacture_year": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "serial_number": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 60
                    },
                    "chassis_number": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 40
                    },
                    "plate_number": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 20
                    },
                    "ownership_type": {
                        "type": "string",
                        "enum": [
                            "owned",
                            "co_owned"
                        ]
                    },
                    "capacity_value": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "capacity_unit": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 20
                    },
                    "coupling_type": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 40
                    },
                    "gross_weight_kg": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "branch_uuid": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "uuid"
                    },
                    "notes": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 2000
                    }
                },
                "required": [
                    "row_version"
                ],
                "title": "UpdateAssetRequest"
            },
            "UpdateDriverRequest": {
                "type": "object",
                "description": "What a key may change on a driver: the name and the notes, nothing else (FG-14, F10 AG-4660). The identity number and type, the border number, the gender, the mobile, the e-mail, the licence numbers, the date of birth, the nationality, the photo, the branch and the status are the panel's; any other key is refused by its name.",
                "properties": {
                    "row_version": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "minimum": 1
                    },
                    "full_name": {
                        "type": "object",
                        "properties": {
                            "ar": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                                "maxLength": 150
                            },
                            "en": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                                "maxLength": 150
                            }
                        }
                    },
                    "notes": {
                        "type": "object",
                        "properties": {
                            "ar": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                                "maxLength": 1000
                            },
                            "en": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                                "maxLength": 1000
                            }
                        }
                    }
                },
                "title": "UpdateDriverRequest"
            },
            "UpdateInspectionScheduleRequest": {
                "type": "object",
                "description": "What a key sends to change the interval of an inspection schedule: the version it read and the new number of days.",
                "properties": {
                    "row_version": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "every_days": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 3650
                    }
                },
                "required": [
                    "row_version",
                    "every_days"
                ],
                "title": "UpdateInspectionScheduleRequest"
            },
            "UpdatePlanRequest": {
                "type": "object",
                "description": "What a key sends to change a maintenance plan: the version it read and any of the plan's terms; what it leaves out stays as it is (D214).",
                "properties": {
                    "row_version": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "name": {
                        "type": "object",
                        "properties": {
                            "ar": {
                                "type": "string",
                                "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                                "maxLength": 100
                            },
                            "en": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                                "maxLength": 100
                            }
                        }
                    },
                    "plan_type": {
                        "type": "string",
                        "maxLength": 20
                    },
                    "category": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 40
                    },
                    "every_km": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "every_days": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "every_hours": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "due_soon_km": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "due_soon_days": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "due_soon_hours": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "baseline_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date"
                    },
                    "baseline_km": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "baseline_hours": {
                        "type": [
                            "number",
                            "null"
                        ]
                    }
                },
                "required": [
                    "row_version"
                ],
                "title": "UpdatePlanRequest"
            },
            "UpdateVehicleRequest": {
                "type": "object",
                "description": "What a key may change on a vehicle: its descriptive fields only. Identity (plate, sequence, VIN, identifier kind, equipment number, legal operator), the catalogue ids, the ownership and vehicle type, branch, visibility, status and archive stay in the panel, and any other key is refused (F10 AG-2790).",
                "properties": {
                    "row_version": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "minimum": 1
                    },
                    "display_name": {
                        "type": "object",
                        "properties": {
                            "ar": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                                "maxLength": 100
                            },
                            "en": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                                "maxLength": 100
                            }
                        }
                    },
                    "colour_code": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 40
                    },
                    "body_type_code": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 40
                    },
                    "manufacture_year": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "capacity_value": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 16
                    },
                    "capacity_unit": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 20
                    },
                    "fuel_consumption_l_per_100km": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 8
                    },
                    "hours_meter_reading": {
                        "type": "string",
                        "maxLength": 12
                    },
                    "hours_meter_reason": {
                        "type": "string",
                        "maxLength": 500
                    },
                    "equipment_serial_number": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                        "maxLength": 60
                    },
                    "map_icon_key": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 40
                    }
                },
                "title": "UpdateVehicleRequest"
            },
            "UpdateViolationRequest": {
                "type": "object",
                "description": "What a key sends to correct a violation: the row version it read and the eight values again; the driver stays as it is.",
                "properties": {
                    "row_version": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "number": {
                        "type": "string",
                        "maxLength": 60
                    },
                    "authority": {
                        "type": "string",
                        "maxLength": 40
                    },
                    "type": {
                        "type": "string",
                        "maxLength": 40
                    },
                    "occurred_at": {
                        "type": "string"
                    },
                    "amount": {
                        "type": "string",
                        "pattern": "^\\d{1,12}(\\.\\d{1,3})?$"
                    },
                    "currency": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "minLength": 3,
                        "maxLength": 3
                    },
                    "due_on": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date"
                    }
                },
                "required": [
                    "row_version",
                    "number",
                    "authority",
                    "type",
                    "occurred_at",
                    "amount"
                ],
                "title": "UpdateViolationRequest"
            },
            "UploadAssetFileRequest": {
                "type": "object",
                "description": "What a key may send to attach a file to a trailer or equipment: the file, its kind and an optional end day; any other field is refused, so no name or note can carry a card or identity number (F10 AG-3200).",
                "properties": {
                    "file": {
                        "type": "string",
                        "format": "binary",
                        "contentMediaType": "application/octet-stream",
                        "description": "Maximum file size: 10240 kilobytes."
                    },
                    "kind": {
                        "type": "string",
                        "enum": [
                            "registration",
                            "insurance",
                            "manual",
                            "photo",
                            "other"
                        ]
                    },
                    "expires_on": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date"
                    }
                },
                "required": [
                    "file",
                    "kind"
                ],
                "title": "UploadAssetFileRequest"
            },
            "UploadDriverDocumentRequest": {
                "type": "object",
                "description": "What a key may send to attach a file to a driver: the file and the kind other; the identity copy stays in the panel and any other field is refused (FG-14, F10 AG-4660).",
                "properties": {
                    "file": {
                        "type": "string",
                        "format": "binary",
                        "contentMediaType": "application/octet-stream",
                        "description": "Maximum file size: 10240 kilobytes."
                    },
                    "kind": {
                        "type": "string",
                        "enum": [
                            "other"
                        ]
                    }
                },
                "required": [
                    "file",
                    "kind"
                ],
                "title": "UploadDriverDocumentRequest"
            },
            "UploadVehicleDocumentRequest": {
                "type": "object",
                "description": "What a key may send to attach a file to a vehicle: the file and its kind, a registration copy or another vehicle document; any other field is refused (F10 AG-2814).",
                "properties": {
                    "file": {
                        "type": "string",
                        "format": "binary",
                        "contentMediaType": "application/octet-stream",
                        "description": "Maximum file size: 10240 kilobytes."
                    },
                    "kind": {
                        "type": "string",
                        "enum": [
                            "vehicle_registration",
                            "other"
                        ]
                    }
                },
                "required": [
                    "file",
                    "kind"
                ],
                "title": "UploadVehicleDocumentRequest"
            },
            "ViolationObjectionOutcomeRequest": {
                "type": "object",
                "description": "What a key sends to record the authority's answer to an objection: the version it read, accepted or not, the day of the answer and an optional note.",
                "properties": {
                    "row_version": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "accepted": {
                        "type": "boolean"
                    },
                    "day": {
                        "type": "string",
                        "format": "date"
                    },
                    "note": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 1000
                    }
                },
                "required": [
                    "row_version",
                    "accepted",
                    "day"
                ],
                "title": "ViolationObjectionOutcomeRequest"
            },
            "VoidAssetFileRequest": {
                "type": "object",
                "description": "The only field a key sends to remove an asset file: the reason; any other field is refused (F10 AG-3200).",
                "properties": {
                    "reason": {
                        "type": "string",
                        "minLength": 10,
                        "maxLength": 500
                    }
                },
                "required": [
                    "reason"
                ],
                "title": "VoidAssetFileRequest"
            },
            "VoidExpenseRequest": {
                "type": "object",
                "description": "What a key may send to void a vehicle expense: the version it read and a reason of at least ten characters, nothing else (F10 AG-2981).",
                "properties": {
                    "row_version": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "reason": {
                        "type": "string",
                        "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                        "minLength": 10,
                        "maxLength": 1000
                    }
                },
                "required": [
                    "row_version",
                    "reason"
                ],
                "title": "VoidExpenseRequest"
            },
            "VoidFuelLogRequest": {
                "type": "object",
                "description": "What a key sends to void a refuel: the version it read and a reason of ten to five hundred characters of plain text with no card number; nothing else (F10 AG-3043).",
                "properties": {
                    "row_version": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "reason": {
                        "type": "string",
                        "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                        "minLength": 10,
                        "maxLength": 500
                    }
                },
                "required": [
                    "row_version",
                    "reason"
                ],
                "title": "VoidFuelLogRequest"
            },
            "VoidIncomeRequest": {
                "type": "object",
                "description": "What a key may send to void a vehicle income: the version it read and a reason of at least ten characters, nothing else (F10 AG-2981).",
                "properties": {
                    "row_version": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "reason": {
                        "type": "string",
                        "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                        "minLength": 10,
                        "maxLength": 1000
                    }
                },
                "required": [
                    "row_version",
                    "reason"
                ],
                "title": "VoidIncomeRequest"
            },
            "VoidLifecycleStageRequest": {
                "type": "object",
                "description": "What a key sends to cancel the last stage of a vehicle: the version it read (a stale one is refused) and a written reason of at least ten characters (F10 AG-2941).",
                "properties": {
                    "version": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "reason": {
                        "type": "string",
                        "minLength": 10,
                        "maxLength": 255
                    }
                },
                "required": [
                    "version",
                    "reason"
                ],
                "title": "VoidLifecycleStageRequest"
            },
            "WebhookActionRequest": {
                "type": "object",
                "description": "What every call that changes a webhook address or sends through it may carry: why it was done, kept in the audit row only (D214 A15).",
                "properties": {
                    "reason": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[^\\x00-\\x1F\\x7F]*$",
                        "minLength": 3,
                        "maxLength": 200
                    }
                },
                "title": "WebhookActionRequest"
            },
            "WebhookResumeRequest": {
                "type": "object",
                "description": "Resuming may give up the events queued while the address was paused instead of sending them now (D214 A15).",
                "properties": {
                    "reason": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[^\\x00-\\x1F\\x7F]*$",
                        "minLength": 3,
                        "maxLength": 200
                    },
                    "abandon_queued": {
                        "type": "boolean"
                    }
                },
                "title": "WebhookResumeRequest"
            },
            "WorkOrderActionRequest": {
                "type": "object",
                "description": "What a key sends to start or cancel a work order: the version it read and, to cancel, the reason; nothing else (F10 AG-2782).",
                "properties": {
                    "row_version": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "reason": {
                        "type": "string",
                        "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                        "minLength": 10,
                        "maxLength": 500
                    },
                    "cost": {
                        "type": "string"
                    },
                    "labour_cost": {
                        "type": "string"
                    },
                    "amount": {
                        "type": "string"
                    }
                },
                "required": [
                    "row_version"
                ],
                "title": "WorkOrderActionRequest"
            }
        },
        "responses": {
            "ValidationException": {
                "description": "Validation error",
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "properties": {
                                "message": {
                                    "type": "string",
                                    "description": "Errors overview."
                                },
                                "errors": {
                                    "type": "object",
                                    "description": "A detailed description of each field that failed validation.",
                                    "additionalProperties": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        }
                                    }
                                }
                            },
                            "required": [
                                "message",
                                "errors"
                            ]
                        }
                    }
                }
            },
            "AuthorizationException": {
                "description": "Authorization error",
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "properties": {
                                "message": {
                                    "type": "string",
                                    "description": "Error overview."
                                }
                            },
                            "required": [
                                "message"
                            ]
                        }
                    }
                }
            },
            "AuthenticationException": {
                "description": "Unauthenticated",
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "properties": {
                                "message": {
                                    "type": "string",
                                    "description": "Error overview."
                                }
                            },
                            "required": [
                                "message"
                            ]
                        }
                    }
                }
            },
            "ModelNotFoundException": {
                "description": "Not found",
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "properties": {
                                "message": {
                                    "type": "string",
                                    "description": "Error overview."
                                }
                            },
                            "required": [
                                "message"
                            ]
                        }
                    }
                }
            },
            "DocumentNotFound": {
                "description": "Not found",
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "properties": {
                                "message": {
                                    "type": "string",
                                    "description": "Error overview."
                                }
                            },
                            "required": [
                                "message"
                            ]
                        }
                    }
                }
            },
            "NotFoundHttpException": {
                "description": "Not found",
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "properties": {
                                "message": {
                                    "type": "string",
                                    "description": "Error overview."
                                }
                            },
                            "required": [
                                "message"
                            ]
                        }
                    }
                }
            }
        }
    }
}