{
  "openapi": "3.1.0",
  "info": {
    "title": "Panalk API",
    "version": "v1",
    "description": "The API for external applications acting for a delivery operator, and for a customer running a store against one or more operators. Every operation names whether it takes an operator key or a customer store key; the health check and the language list are public. Every operation accepts Accept-Language and answers with Content-Language; the supported codes are returned by GET /api/v1/languages."
  },
  "servers": [
    {
      "url": "https://api.panalk.xyz",
      "description": "Production"
    },
    {
      "url": "http://localhost:4005",
      "description": "A development box"
    }
  ],
  "tags": [
    {
      "name": "organisation"
    },
    {
      "name": "customers"
    },
    {
      "name": "recipients"
    },
    {
      "name": "deliveries"
    },
    {
      "name": "fleet"
    },
    {
      "name": "support"
    },
    {
      "name": "stores"
    },
    {
      "name": "health"
    },
    {
      "name": "languages"
    }
  ],
  "paths": {
    "/api/v1/customer/integration/discovery/operators": {
      "get": {
        "operationId": "customerIntegration.discovery",
        "tags": ["stores"],
        "description": "Lists licensed operators whose coverage matches the route; requires an accepted application.",
        "x-panalk-auth": "customer-api-key",
        "x-required-scopes": ["discovery:read"],
        "security": [
          {
            "customerApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AcceptLanguage"
          },
          {
            "name": "origin_place_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            }
          },
          {
            "name": "destination_place_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Content-Language": {
                "$ref": "#/components/headers/ContentLanguage"
              }
            }
          },
          "401": {
            "description": "The customer API key is missing, unknown, revoked or expired."
          },
          "403": {
            "description": "The key lacks the scope, its application is not accepted, or the source is not allowed."
          },
          "404": {
            "description": "The delivery no longer exists."
          },
          "422": {
            "description": "A value failed validation; the envelope lists the fields."
          },
          "429": {
            "description": "The customer exceeded its request or order allowance."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/v1/customer/integration/me": {
      "get": {
        "operationId": "customerIntegration.me",
        "tags": ["stores"],
        "description": "Returns the store's account, access level, scopes and current limits.",
        "x-panalk-auth": "customer-api-key",
        "security": [
          {
            "customerApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AcceptLanguage"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Content-Language": {
                "$ref": "#/components/headers/ContentLanguage"
              }
            }
          },
          "401": {
            "description": "The customer API key is missing, unknown, revoked or expired."
          },
          "403": {
            "description": "The key lacks the scope, its application is not accepted, or the source is not allowed."
          },
          "404": {
            "description": "The delivery no longer exists."
          },
          "429": {
            "description": "The customer exceeded its request or order allowance."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/v1/customer/integration/operators": {
      "get": {
        "operationId": "customerIntegration.operators",
        "tags": ["stores"],
        "description": "Lists the operators that already have this verified address on file as a customer.",
        "x-panalk-auth": "customer-api-key",
        "x-required-scopes": ["operators:read"],
        "security": [
          {
            "customerApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AcceptLanguage"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Content-Language": {
                "$ref": "#/components/headers/ContentLanguage"
              }
            }
          },
          "401": {
            "description": "The customer API key is missing, unknown, revoked or expired."
          },
          "403": {
            "description": "The key lacks the scope, its application is not accepted, or the source is not allowed."
          },
          "404": {
            "description": "The delivery no longer exists."
          },
          "429": {
            "description": "The customer exceeded its request or order allowance."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/v1/customer/integration/orders": {
      "get": {
        "operationId": "customerIntegration.list",
        "tags": ["stores"],
        "description": "Lists this store's orders, newest first.",
        "x-panalk-auth": "customer-api-key",
        "x-required-scopes": ["orders:read"],
        "security": [
          {
            "customerApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AcceptLanguage"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "default": 0,
              "type": "integer",
              "minimum": 0,
              "maximum": 10000
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": ["requested", "accepted", "declined", "cancelled"]
            }
          },
          {
            "name": "external_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 120
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Content-Language": {
                "$ref": "#/components/headers/ContentLanguage"
              }
            }
          },
          "401": {
            "description": "The customer API key is missing, unknown, revoked or expired."
          },
          "403": {
            "description": "The key lacks the scope, its application is not accepted, or the source is not allowed."
          },
          "404": {
            "description": "The delivery no longer exists."
          },
          "422": {
            "description": "A value failed validation; the envelope lists the fields."
          },
          "429": {
            "description": "The customer exceeded its request or order allowance."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "customerIntegration.create",
        "tags": ["stores"],
        "description": "Creates an order with a connected operator, or with a matched operator when marketplace access is granted.",
        "x-panalk-auth": "customer-api-key",
        "x-required-scopes": ["orders:write", "orders:read"],
        "security": [
          {
            "customerApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AcceptLanguage"
          }
        ],
        "responses": {
          "201": {
            "description": "Success.",
            "headers": {
              "Content-Language": {
                "$ref": "#/components/headers/ContentLanguage"
              }
            }
          },
          "400": {
            "description": "The request body could not be read as JSON."
          },
          "401": {
            "description": "The customer API key is missing, unknown, revoked or expired."
          },
          "403": {
            "description": "The key lacks the scope, its application is not accepted, or the source is not allowed."
          },
          "404": {
            "description": "The delivery no longer exists."
          },
          "422": {
            "description": "A value failed validation; the envelope lists the fields."
          },
          "429": {
            "description": "The customer exceeded its request or order allowance."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "external_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "organisation_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "origin": {
                    "type": "object",
                    "properties": {
                      "place_id": {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      "address_line": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 240
                      }
                    },
                    "required": ["place_id"],
                    "additionalProperties": false
                  },
                  "destination": {
                    "type": "object",
                    "properties": {
                      "place_id": {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      "address_line": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 240
                      }
                    },
                    "required": ["place_id"],
                    "additionalProperties": false
                  },
                  "recipient": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120
                      },
                      "phone": {
                        "type": "string",
                        "minLength": 5,
                        "maxLength": 30
                      },
                      "email": {
                        "type": "string",
                        "maxLength": 254,
                        "format": "email",
                        "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                      }
                    },
                    "required": ["name", "phone"],
                    "additionalProperties": false
                  },
                  "service_level": {
                    "default": "standard",
                    "type": "string",
                    "enum": ["standard", "express"]
                  },
                  "package": {
                    "type": "object",
                    "properties": {
                      "description": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "package_type": {
                        "type": "string",
                        "enum": ["document", "parcel", "box", "pallet", "other"]
                      },
                      "weight_grams": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 1000000
                      },
                      "length_cm": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 300
                      },
                      "width_cm": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 300
                      },
                      "height_cm": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 300
                      }
                    },
                    "required": ["description"],
                    "additionalProperties": false
                  },
                  "notes": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "required": [
                  "external_id",
                  "organisation_id",
                  "origin",
                  "destination",
                  "recipient",
                  "package"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/customer/integration/orders/{id}": {
      "get": {
        "operationId": "customerIntegration.get",
        "tags": ["stores"],
        "description": "Returns one order with its delivery story and payment summary.",
        "x-panalk-auth": "customer-api-key",
        "x-required-scopes": ["orders:read"],
        "security": [
          {
            "customerApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AcceptLanguage"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Content-Language": {
                "$ref": "#/components/headers/ContentLanguage"
              }
            }
          },
          "401": {
            "description": "The customer API key is missing, unknown, revoked or expired."
          },
          "403": {
            "description": "The key lacks the scope, its application is not accepted, or the source is not allowed."
          },
          "404": {
            "description": "The delivery no longer exists."
          },
          "422": {
            "description": "A value failed validation; the envelope lists the fields."
          },
          "429": {
            "description": "The customer exceeded its request or order allowance."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/v1/customer/integration/orders/{id}/cancel": {
      "post": {
        "operationId": "customerIntegration.cancel",
        "tags": ["stores"],
        "description": "Cancels an order that is still waiting for the operator to answer.",
        "x-panalk-auth": "customer-api-key",
        "x-required-scopes": ["orders:write", "orders:read"],
        "security": [
          {
            "customerApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AcceptLanguage"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Content-Language": {
                "$ref": "#/components/headers/ContentLanguage"
              }
            }
          },
          "401": {
            "description": "The customer API key is missing, unknown, revoked or expired."
          },
          "403": {
            "description": "The key lacks the scope, its application is not accepted, or the source is not allowed."
          },
          "404": {
            "description": "The delivery no longer exists."
          },
          "422": {
            "description": "A value failed validation; the envelope lists the fields."
          },
          "429": {
            "description": "The customer exceeded its request or order allowance."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/v1/customer/integration/orders/{id}/payment": {
      "post": {
        "operationId": "customerIntegration.payment",
        "tags": ["stores"],
        "description": "Returns the provider checkout link for an accepted order's delivery payment.",
        "x-panalk-auth": "customer-api-key",
        "x-required-scopes": ["orders:write", "orders:read"],
        "security": [
          {
            "customerApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AcceptLanguage"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Content-Language": {
                "$ref": "#/components/headers/ContentLanguage"
              }
            }
          },
          "401": {
            "description": "The customer API key is missing, unknown, revoked or expired."
          },
          "403": {
            "description": "The key lacks the scope, its application is not accepted, or the source is not allowed."
          },
          "404": {
            "description": "The delivery no longer exists."
          },
          "422": {
            "description": "A value failed validation; the envelope lists the fields."
          },
          "429": {
            "description": "The customer exceeded its request or order allowance."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/v1/customer/integration/quotes": {
      "post": {
        "operationId": "customerIntegration.quote",
        "tags": ["stores"],
        "description": "Prices one parcel for an operator this store is allowed to use.",
        "x-panalk-auth": "customer-api-key",
        "x-required-scopes": ["quotes:write"],
        "security": [
          {
            "customerApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AcceptLanguage"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Content-Language": {
                "$ref": "#/components/headers/ContentLanguage"
              }
            }
          },
          "400": {
            "description": "The request body could not be read as JSON."
          },
          "401": {
            "description": "The customer API key is missing, unknown, revoked or expired."
          },
          "403": {
            "description": "The key lacks the scope, its application is not accepted, or the source is not allowed."
          },
          "404": {
            "description": "The delivery no longer exists."
          },
          "422": {
            "description": "A value failed validation; the envelope lists the fields."
          },
          "429": {
            "description": "The customer exceeded its request or order allowance."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "organisation_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "origin": {
                    "type": "object",
                    "properties": {
                      "place_id": {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      "address_line": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 240
                      }
                    },
                    "required": ["place_id"],
                    "additionalProperties": false
                  },
                  "destination": {
                    "type": "object",
                    "properties": {
                      "place_id": {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      "address_line": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 240
                      }
                    },
                    "required": ["place_id"],
                    "additionalProperties": false
                  },
                  "service_level": {
                    "default": "standard",
                    "type": "string",
                    "enum": ["standard", "express"]
                  },
                  "package_type": {
                    "type": "string",
                    "enum": ["document", "parcel", "box", "pallet", "other"]
                  },
                  "weight_grams": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000000
                  },
                  "length_cm": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 300
                  },
                  "width_cm": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 300
                  },
                  "height_cm": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 300
                  }
                },
                "required": ["organisation_id", "origin", "destination"],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/customer/integration/usage": {
      "get": {
        "operationId": "customerIntegration.usage",
        "tags": ["stores"],
        "description": "Returns the request, order, key and webhook allowance in use.",
        "x-panalk-auth": "customer-api-key",
        "security": [
          {
            "customerApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AcceptLanguage"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Content-Language": {
                "$ref": "#/components/headers/ContentLanguage"
              }
            }
          },
          "401": {
            "description": "The customer API key is missing, unknown, revoked or expired."
          },
          "403": {
            "description": "The key lacks the scope, its application is not accepted, or the source is not allowed."
          },
          "404": {
            "description": "The delivery no longer exists."
          },
          "429": {
            "description": "The customer exceeded its request or order allowance."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/v1/customer/integration/webhooks": {
      "get": {
        "operationId": "customerIntegration.listWebhooks",
        "tags": ["stores"],
        "description": "Lists the store's webhook endpoints.",
        "x-panalk-auth": "customer-api-key",
        "x-required-scopes": ["webhooks:read"],
        "security": [
          {
            "customerApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AcceptLanguage"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "default": 0,
              "type": "integer",
              "minimum": 0,
              "maximum": 10000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Content-Language": {
                "$ref": "#/components/headers/ContentLanguage"
              }
            }
          },
          "401": {
            "description": "The customer API key is missing, unknown, revoked or expired."
          },
          "403": {
            "description": "The key lacks the scope, its application is not accepted, or the source is not allowed."
          },
          "404": {
            "description": "The delivery no longer exists."
          },
          "422": {
            "description": "A value failed validation; the envelope lists the fields."
          },
          "429": {
            "description": "The customer exceeded its request or order allowance."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "customerIntegration.createWebhook",
        "tags": ["stores"],
        "description": "Registers a signed HTTPS endpoint for the order events this store chooses.",
        "x-panalk-auth": "customer-api-key",
        "x-required-scopes": ["webhooks:write"],
        "security": [
          {
            "customerApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AcceptLanguage"
          }
        ],
        "responses": {
          "201": {
            "description": "Success.",
            "headers": {
              "Content-Language": {
                "$ref": "#/components/headers/ContentLanguage"
              }
            }
          },
          "400": {
            "description": "The request body could not be read as JSON."
          },
          "401": {
            "description": "The customer API key is missing, unknown, revoked or expired."
          },
          "403": {
            "description": "The key lacks the scope, its application is not accepted, or the source is not allowed."
          },
          "404": {
            "description": "The delivery no longer exists."
          },
          "422": {
            "description": "A value failed validation; the envelope lists the fields."
          },
          "429": {
            "description": "The customer exceeded its request or order allowance."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "events": {
                    "minItems": 1,
                    "maxItems": 6,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "order.requested",
                        "order.accepted",
                        "order.declined",
                        "order.cancelled",
                        "payment.requested",
                        "payment.succeeded"
                      ]
                    }
                  }
                },
                "required": ["url", "events"]
              }
            }
          }
        }
      }
    },
    "/api/v1/customer/integration/webhooks/{webhookId}": {
      "delete": {
        "operationId": "customerIntegration.removeWebhook",
        "tags": ["stores"],
        "description": "Deletes a webhook endpoint and its queued deliveries.",
        "x-panalk-auth": "customer-api-key",
        "x-required-scopes": ["webhooks:write"],
        "security": [
          {
            "customerApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AcceptLanguage"
          },
          {
            "name": "webhookId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Success.",
            "headers": {
              "Content-Language": {
                "$ref": "#/components/headers/ContentLanguage"
              }
            }
          },
          "401": {
            "description": "The customer API key is missing, unknown, revoked or expired."
          },
          "403": {
            "description": "The key lacks the scope, its application is not accepted, or the source is not allowed."
          },
          "404": {
            "description": "The delivery no longer exists."
          },
          "422": {
            "description": "A value failed validation; the envelope lists the fields."
          },
          "429": {
            "description": "The customer exceeded its request or order allowance."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "patch": {
        "operationId": "customerIntegration.updateWebhook",
        "tags": ["stores"],
        "description": "Changes a webhook endpoint's address, events or status.",
        "x-panalk-auth": "customer-api-key",
        "x-required-scopes": ["webhooks:write"],
        "security": [
          {
            "customerApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AcceptLanguage"
          },
          {
            "name": "webhookId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Content-Language": {
                "$ref": "#/components/headers/ContentLanguage"
              }
            }
          },
          "400": {
            "description": "The request body could not be read as JSON."
          },
          "401": {
            "description": "The customer API key is missing, unknown, revoked or expired."
          },
          "403": {
            "description": "The key lacks the scope, its application is not accepted, or the source is not allowed."
          },
          "404": {
            "description": "The delivery no longer exists."
          },
          "422": {
            "description": "A value failed validation; the envelope lists the fields."
          },
          "429": {
            "description": "The customer exceeded its request or order allowance."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048
                  },
                  "description": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "events": {
                    "minItems": 1,
                    "maxItems": 6,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "order.requested",
                        "order.accepted",
                        "order.declined",
                        "order.cancelled",
                        "payment.requested",
                        "payment.succeeded"
                      ]
                    }
                  },
                  "status": {
                    "type": "string",
                    "enum": ["active", "paused"]
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/customer/integration/webhooks/{webhookId}/rotate": {
      "post": {
        "operationId": "customerIntegration.rotateWebhook",
        "tags": ["stores"],
        "description": "Rotates a webhook endpoint's signing secret and returns the new one once.",
        "x-panalk-auth": "customer-api-key",
        "x-required-scopes": ["webhooks:write"],
        "security": [
          {
            "customerApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AcceptLanguage"
          },
          {
            "name": "webhookId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Content-Language": {
                "$ref": "#/components/headers/ContentLanguage"
              }
            }
          },
          "401": {
            "description": "The customer API key is missing, unknown, revoked or expired."
          },
          "403": {
            "description": "The key lacks the scope, its application is not accepted, or the source is not allowed."
          },
          "404": {
            "description": "The delivery no longer exists."
          },
          "422": {
            "description": "A value failed validation; the envelope lists the fields."
          },
          "429": {
            "description": "The customer exceeded its request or order allowance."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/v1/integration/branches": {
      "get": {
        "operationId": "integrationFleet.branches",
        "tags": ["fleet"],
        "description": "Lists the branches an external dispatcher can route a delivery through.",
        "x-panalk-auth": "api-key",
        "x-required-scopes": ["fleet:read"],
        "security": [
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AcceptLanguage"
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 80
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Content-Language": {
                "$ref": "#/components/headers/ContentLanguage"
              }
            }
          },
          "401": {
            "description": "The API key is missing, unknown, revoked, or expired."
          },
          "403": {
            "description": "The key does not carry the scope this operation requires, the source is not allowed, or the plan has no API access."
          },
          "422": {
            "description": "A value failed validation; the envelope lists the fields."
          },
          "429": {
            "description": "The key exceeded its plan rate limit; retry after the window."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/v1/integration/customers": {
      "get": {
        "operationId": "integrationCustomer.list",
        "tags": ["customers"],
        "description": "Lists the organisation's active senders, newest first, with optional search and paging.",
        "x-panalk-auth": "api-key",
        "x-required-scopes": ["customers:read"],
        "security": [
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AcceptLanguage"
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 80
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Content-Language": {
                "$ref": "#/components/headers/ContentLanguage"
              }
            }
          },
          "401": {
            "description": "The API key is missing, unknown, revoked, or expired."
          },
          "403": {
            "description": "The key does not carry the scope this operation requires, the source is not allowed, or the plan has no API access."
          },
          "422": {
            "description": "A value failed validation; the envelope lists the fields."
          },
          "429": {
            "description": "The key exceeded its plan rate limit; retry after the window."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "integrationCustomer.create",
        "tags": ["customers"],
        "description": "Creates a sender with a name and at least an email address or a phone number.",
        "x-panalk-auth": "api-key",
        "x-required-scopes": ["customers:write"],
        "security": [
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AcceptLanguage"
          }
        ],
        "responses": {
          "201": {
            "description": "Success.",
            "headers": {
              "Content-Language": {
                "$ref": "#/components/headers/ContentLanguage"
              }
            }
          },
          "400": {
            "description": "The request body could not be read as JSON."
          },
          "401": {
            "description": "The API key is missing, unknown, revoked, or expired."
          },
          "403": {
            "description": "The key does not carry the scope this operation requires, the source is not allowed, or the plan has no API access."
          },
          "422": {
            "description": "A value failed validation; the envelope lists the fields."
          },
          "429": {
            "description": "The key exceeded its plan rate limit; retry after the window."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "phone": {
                    "type": "string",
                    "minLength": 5,
                    "maxLength": 30
                  },
                  "email": {
                    "type": "string",
                    "maxLength": 200,
                    "format": "email",
                    "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                  }
                },
                "required": ["name"]
              }
            }
          }
        }
      }
    },
    "/api/v1/integration/customers/{id}": {
      "get": {
        "operationId": "integrationCustomer.get",
        "tags": ["customers"],
        "description": "Returns one sender in the organisation by id.",
        "x-panalk-auth": "api-key",
        "x-required-scopes": ["customers:read"],
        "security": [
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AcceptLanguage"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Content-Language": {
                "$ref": "#/components/headers/ContentLanguage"
              }
            }
          },
          "401": {
            "description": "The API key is missing, unknown, revoked, or expired."
          },
          "403": {
            "description": "The key does not carry the scope this operation requires, the source is not allowed, or the plan has no API access."
          },
          "404": {
            "description": "The record does not exist, or the caller is not a member."
          },
          "422": {
            "description": "A value failed validation; the envelope lists the fields."
          },
          "429": {
            "description": "The key exceeded its plan rate limit; retry after the window."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "patch": {
        "operationId": "integrationCustomer.update",
        "tags": ["customers"],
        "description": "Corrects a sender's name, email or phone.",
        "x-panalk-auth": "api-key",
        "x-required-scopes": ["customers:write"],
        "security": [
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AcceptLanguage"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Content-Language": {
                "$ref": "#/components/headers/ContentLanguage"
              }
            }
          },
          "400": {
            "description": "The request body could not be read as JSON."
          },
          "401": {
            "description": "The API key is missing, unknown, revoked, or expired."
          },
          "403": {
            "description": "The key does not carry the scope this operation requires, the source is not allowed, or the plan has no API access."
          },
          "404": {
            "description": "The record does not exist, or the caller is not a member."
          },
          "422": {
            "description": "A value failed validation; the envelope lists the fields."
          },
          "429": {
            "description": "The key exceeded its plan rate limit; retry after the window."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "phone": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 5,
                        "maxLength": 30
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "email": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 200,
                        "format": "email",
                        "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integration/deliveries": {
      "get": {
        "operationId": "integration.list",
        "tags": ["deliveries"],
        "description": "Lists the deliveries created through the integration, newest first, with an optional status or external id.",
        "x-panalk-auth": "api-key",
        "x-required-scopes": ["deliveries:read"],
        "security": [
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AcceptLanguage"
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "draft",
                "quoted",
                "accepted",
                "awaiting_collection",
                "in_transit",
                "awaiting_handover",
                "completed",
                "failed",
                "cancelled",
                "returned"
              ]
            }
          },
          {
            "name": "external_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 120
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Content-Language": {
                "$ref": "#/components/headers/ContentLanguage"
              }
            }
          },
          "401": {
            "description": "The API key is missing, unknown, revoked, or expired."
          },
          "403": {
            "description": "The key does not carry the scope this operation requires, the source is not allowed, or the plan has no API access."
          },
          "422": {
            "description": "A value failed validation; the envelope lists the fields."
          },
          "429": {
            "description": "The key exceeded its plan rate limit; retry after the window."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "integration.create",
        "tags": ["deliveries"],
        "description": "Creates a delivery from an external order. Repeating the same external id returns the first delivery rather than creating a second.",
        "x-panalk-auth": "api-key",
        "x-required-scopes": ["deliveries:write", "deliveries:read"],
        "security": [
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AcceptLanguage"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Content-Language": {
                "$ref": "#/components/headers/ContentLanguage"
              }
            }
          },
          "400": {
            "description": "The request body could not be read as JSON."
          },
          "401": {
            "description": "The API key is missing, unknown, revoked, or expired."
          },
          "403": {
            "description": "The key does not carry the scope this operation requires, the source is not allowed, or the plan has no API access."
          },
          "422": {
            "description": "A value failed validation; the envelope lists the fields."
          },
          "429": {
            "description": "The key exceeded its plan rate limit; retry after the window."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "external_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "customer": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120
                      },
                      "email": {
                        "type": "string",
                        "maxLength": 200,
                        "format": "email",
                        "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                      },
                      "phone": {
                        "type": "string",
                        "minLength": 5,
                        "maxLength": 30
                      }
                    },
                    "required": ["name", "email"]
                  },
                  "recipient": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120
                      },
                      "phone": {
                        "type": "string",
                        "minLength": 5,
                        "maxLength": 30
                      },
                      "place_id": {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      "address_line": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 240
                      }
                    },
                    "required": ["name", "phone"]
                  },
                  "origin": {
                    "type": "object",
                    "properties": {
                      "place_id": {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      "address_line": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 240
                      }
                    }
                  },
                  "destination": {
                    "type": "object",
                    "properties": {
                      "place_id": {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      "address_line": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 240
                      }
                    }
                  },
                  "service_level": {
                    "type": "string",
                    "enum": ["standard", "express"]
                  },
                  "promised_from": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "promised_to": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "declared_value_minor": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 2000000000
                  },
                  "packages": {
                    "minItems": 1,
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "package_type": {
                          "type": "string",
                          "enum": ["document", "parcel", "box", "pallet", "other"]
                        },
                        "weight_grams": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 1000000
                        },
                        "length_cm": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 300
                        },
                        "width_cm": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 300
                        },
                        "height_cm": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 300
                        },
                        "description": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "declared_value_minor": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 2000000000
                        }
                      }
                    }
                  }
                },
                "required": [
                  "external_id",
                  "customer",
                  "recipient",
                  "origin",
                  "destination",
                  "packages"
                ]
              }
            }
          }
        }
      }
    },
    "/api/v1/integration/deliveries/{trackingCode}": {
      "get": {
        "operationId": "integration.get",
        "tags": ["deliveries"],
        "description": "Returns one delivery by tracking code, with its parcels, legs and event history.",
        "x-panalk-auth": "api-key",
        "x-required-scopes": ["deliveries:read"],
        "security": [
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AcceptLanguage"
          },
          {
            "name": "trackingCode",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 3,
              "maxLength": 40
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Content-Language": {
                "$ref": "#/components/headers/ContentLanguage"
              }
            }
          },
          "401": {
            "description": "The API key is missing, unknown, revoked, or expired."
          },
          "403": {
            "description": "The key does not carry the scope this operation requires, the source is not allowed, or the plan has no API access."
          },
          "404": {
            "description": "The record does not exist, or the caller is not a member."
          },
          "422": {
            "description": "A value failed validation; the envelope lists the fields."
          },
          "429": {
            "description": "The key exceeded its plan rate limit; retry after the window."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/v1/integration/deliveries/{trackingCode}/assign": {
      "post": {
        "operationId": "integration.assign",
        "tags": ["deliveries"],
        "description": "Offers the first unassigned leg to a driver, with an optional vehicle.",
        "x-panalk-auth": "api-key",
        "x-required-scopes": ["deliveries:write", "deliveries:read"],
        "security": [
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AcceptLanguage"
          },
          {
            "name": "trackingCode",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 3,
              "maxLength": 40
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Content-Language": {
                "$ref": "#/components/headers/ContentLanguage"
              }
            }
          },
          "400": {
            "description": "The request body could not be read as JSON."
          },
          "401": {
            "description": "The API key is missing, unknown, revoked, or expired."
          },
          "403": {
            "description": "The key does not carry the scope this operation requires, the source is not allowed, or the plan has no API access."
          },
          "404": {
            "description": "The record does not exist, or the caller is not a member."
          },
          "422": {
            "description": "A value failed validation; the envelope lists the fields."
          },
          "429": {
            "description": "The key exceeded its plan rate limit; retry after the window."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "driver_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "vehicle_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  }
                },
                "required": ["driver_id"]
              }
            }
          }
        }
      }
    },
    "/api/v1/integration/drivers": {
      "get": {
        "operationId": "integrationFleet.drivers",
        "tags": ["fleet"],
        "description": "Lists the driver records an external dispatcher may choose from.",
        "x-panalk-auth": "api-key",
        "x-required-scopes": ["fleet:read"],
        "security": [
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AcceptLanguage"
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 80
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Content-Language": {
                "$ref": "#/components/headers/ContentLanguage"
              }
            }
          },
          "401": {
            "description": "The API key is missing, unknown, revoked, or expired."
          },
          "403": {
            "description": "The key does not carry the scope this operation requires, the source is not allowed, or the plan has no API access."
          },
          "422": {
            "description": "A value failed validation; the envelope lists the fields."
          },
          "429": {
            "description": "The key exceeded its plan rate limit; retry after the window."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/v1/integration/organisation": {
      "get": {
        "operationId": "integrationOrganisation.current",
        "tags": ["organisation"],
        "description": "Returns the organisation this key acts for: name, slug, timezone and locale.",
        "x-panalk-auth": "api-key",
        "x-required-scopes": ["organisation:read"],
        "security": [
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AcceptLanguage"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Content-Language": {
                "$ref": "#/components/headers/ContentLanguage"
              }
            }
          },
          "401": {
            "description": "The API key is missing, unknown, revoked, or expired."
          },
          "403": {
            "description": "The key does not carry the scope this operation requires, the source is not allowed, or the plan has no API access."
          },
          "429": {
            "description": "The key exceeded its plan rate limit; retry after the window."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/v1/integration/recipients": {
      "get": {
        "operationId": "integrationRecipient.list",
        "tags": ["recipients"],
        "description": "Lists the people the organisation delivers to, newest first, with optional search and paging.",
        "x-panalk-auth": "api-key",
        "x-required-scopes": ["recipients:read"],
        "security": [
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AcceptLanguage"
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 80
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Content-Language": {
                "$ref": "#/components/headers/ContentLanguage"
              }
            }
          },
          "401": {
            "description": "The API key is missing, unknown, revoked, or expired."
          },
          "403": {
            "description": "The key does not carry the scope this operation requires, the source is not allowed, or the plan has no API access."
          },
          "422": {
            "description": "A value failed validation; the envelope lists the fields."
          },
          "429": {
            "description": "The key exceeded its plan rate limit; retry after the window."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "integrationRecipient.create",
        "tags": ["recipients"],
        "description": "Creates a recipient with a name and phone, and optionally a shared place, address or landmark.",
        "x-panalk-auth": "api-key",
        "x-required-scopes": ["recipients:write"],
        "security": [
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AcceptLanguage"
          }
        ],
        "responses": {
          "201": {
            "description": "Success.",
            "headers": {
              "Content-Language": {
                "$ref": "#/components/headers/ContentLanguage"
              }
            }
          },
          "400": {
            "description": "The request body could not be read as JSON."
          },
          "401": {
            "description": "The API key is missing, unknown, revoked, or expired."
          },
          "403": {
            "description": "The key does not carry the scope this operation requires, the source is not allowed, or the plan has no API access."
          },
          "422": {
            "description": "A value failed validation; the envelope lists the fields."
          },
          "429": {
            "description": "The key exceeded its plan rate limit; retry after the window."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "phone": {
                    "type": "string",
                    "minLength": 5,
                    "maxLength": 30
                  },
                  "place_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "address_line": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 240
                  },
                  "landmark": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  }
                },
                "required": ["name", "phone"]
              }
            }
          }
        }
      }
    },
    "/api/v1/integration/recipients/{id}": {
      "get": {
        "operationId": "integrationRecipient.get",
        "tags": ["recipients"],
        "description": "Returns one recipient in the organisation by id.",
        "x-panalk-auth": "api-key",
        "x-required-scopes": ["recipients:read"],
        "security": [
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AcceptLanguage"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Content-Language": {
                "$ref": "#/components/headers/ContentLanguage"
              }
            }
          },
          "401": {
            "description": "The API key is missing, unknown, revoked, or expired."
          },
          "403": {
            "description": "The key does not carry the scope this operation requires, the source is not allowed, or the plan has no API access."
          },
          "404": {
            "description": "The record does not exist, or the caller is not a member."
          },
          "422": {
            "description": "A value failed validation; the envelope lists the fields."
          },
          "429": {
            "description": "The key exceeded its plan rate limit; retry after the window."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "patch": {
        "operationId": "integrationRecipient.update",
        "tags": ["recipients"],
        "description": "Corrects a recipient's name, phone, place or address.",
        "x-panalk-auth": "api-key",
        "x-required-scopes": ["recipients:write"],
        "security": [
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AcceptLanguage"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Content-Language": {
                "$ref": "#/components/headers/ContentLanguage"
              }
            }
          },
          "400": {
            "description": "The request body could not be read as JSON."
          },
          "401": {
            "description": "The API key is missing, unknown, revoked, or expired."
          },
          "403": {
            "description": "The key does not carry the scope this operation requires, the source is not allowed, or the plan has no API access."
          },
          "404": {
            "description": "The record does not exist, or the caller is not a member."
          },
          "422": {
            "description": "A value failed validation; the envelope lists the fields."
          },
          "429": {
            "description": "The key exceeded its plan rate limit; retry after the window."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "phone": {
                    "type": "string",
                    "minLength": 5,
                    "maxLength": 30
                  },
                  "place_id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "address_line": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 240
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "landmark": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integration/support/tickets": {
      "get": {
        "operationId": "integrationSupport.list",
        "tags": ["support"],
        "description": "Lists the customer support conversations, newest activity first.",
        "x-panalk-auth": "api-key",
        "x-required-scopes": ["support:read"],
        "security": [
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AcceptLanguage"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Content-Language": {
                "$ref": "#/components/headers/ContentLanguage"
              }
            }
          },
          "401": {
            "description": "The API key is missing, unknown, revoked, or expired."
          },
          "403": {
            "description": "The key does not carry the scope this operation requires, the source is not allowed, or the plan has no API access."
          },
          "422": {
            "description": "A value failed validation; the envelope lists the fields."
          },
          "429": {
            "description": "The key exceeded its plan rate limit; retry after the window."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/v1/integration/support/tickets/{ticketId}": {
      "get": {
        "operationId": "integrationSupport.thread",
        "tags": ["support"],
        "description": "Returns one customer conversation and its messages.",
        "x-panalk-auth": "api-key",
        "x-required-scopes": ["support:read"],
        "security": [
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AcceptLanguage"
          },
          {
            "name": "ticketId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Content-Language": {
                "$ref": "#/components/headers/ContentLanguage"
              }
            }
          },
          "401": {
            "description": "The API key is missing, unknown, revoked, or expired."
          },
          "403": {
            "description": "The key does not carry the scope this operation requires, the source is not allowed, or the plan has no API access."
          },
          "404": {
            "description": "The record does not exist, or the caller is not a member."
          },
          "422": {
            "description": "A value failed validation; the envelope lists the fields."
          },
          "429": {
            "description": "The key exceeded its plan rate limit; retry after the window."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/v1/integration/support/tickets/{ticketId}/messages": {
      "post": {
        "operationId": "integrationSupport.reply",
        "tags": ["support"],
        "description": "Adds a staff reply to an open customer conversation and emails the customer a fresh link.",
        "x-panalk-auth": "api-key",
        "x-required-scopes": ["support:write", "support:read"],
        "security": [
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AcceptLanguage"
          },
          {
            "name": "ticketId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Success.",
            "headers": {
              "Content-Language": {
                "$ref": "#/components/headers/ContentLanguage"
              }
            }
          },
          "400": {
            "description": "The request body could not be read as JSON."
          },
          "401": {
            "description": "The API key is missing, unknown, revoked, or expired."
          },
          "403": {
            "description": "The key does not carry the scope this operation requires, the source is not allowed, or the plan has no API access."
          },
          "404": {
            "description": "The record does not exist, or the caller is not a member."
          },
          "422": {
            "description": "A value failed validation; the envelope lists the fields."
          },
          "429": {
            "description": "The key exceeded its plan rate limit; retry after the window."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 4000
                  }
                },
                "required": ["message"]
              }
            }
          }
        }
      }
    },
    "/api/v1/integration/vehicles": {
      "get": {
        "operationId": "integrationFleet.vehicles",
        "tags": ["fleet"],
        "description": "Lists the vehicle records an external dispatcher may choose from.",
        "x-panalk-auth": "api-key",
        "x-required-scopes": ["fleet:read"],
        "security": [
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AcceptLanguage"
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 80
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Content-Language": {
                "$ref": "#/components/headers/ContentLanguage"
              }
            }
          },
          "401": {
            "description": "The API key is missing, unknown, revoked, or expired."
          },
          "403": {
            "description": "The key does not carry the scope this operation requires, the source is not allowed, or the plan has no API access."
          },
          "422": {
            "description": "A value failed validation; the envelope lists the fields."
          },
          "429": {
            "description": "The key exceeded its plan rate limit; retry after the window."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/v1/languages": {
      "get": {
        "operationId": "languages.list",
        "tags": ["languages"],
        "description": "Returns the language codes the API accepts in Accept-Language and the default it uses when none is recognised.",
        "x-panalk-auth": "none",
        "security": [],
        "parameters": [
          {
            "$ref": "#/components/parameters/AcceptLanguage"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Content-Language": {
                "$ref": "#/components/headers/ContentLanguage"
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/health": {
      "get": {
        "operationId": "health.check",
        "tags": ["health"],
        "description": "Reports that the API is reachable and whether its database answers.",
        "x-panalk-auth": "none",
        "security": [],
        "parameters": [
          {
            "$ref": "#/components/parameters/AcceptLanguage"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Content-Language": {
                "$ref": "#/components/headers/ContentLanguage"
              }
            }
          },
          "503": {
            "description": "The database could not be reached."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "AcceptLanguage": {
        "name": "Accept-Language",
        "in": "header",
        "required": false,
        "description": "The language for the response message. Supported codes: en, fr, ig, yo, ha. A tag outside the list is ignored and en is used.",
        "schema": {
          "type": "string",
          "default": "en",
          "examples": ["en", "fr", "ig", "yo", "ha"]
        }
      }
    },
    "headers": {
      "ContentLanguage": {
        "description": "The language actually used for the response message.",
        "schema": {
          "type": "string",
          "example": "en"
        }
      }
    },
    "securitySchemes": {
      "apiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key",
        "description": "An API key created in the operator dashboard. The full key is shown once. It acts only inside its organisation and only for its scopes."
      },
      "customerApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key",
        "description": "A customer store key created in the customer portal. It acts through the verified customer address, for the operators that know that address, or for discovery after a platform-approved application."
      }
    },
    "schemas": {
      "ErrorEnvelope": {
        "type": "object",
        "required": ["error"],
        "properties": {
          "error": {
            "type": "object",
            "required": ["code", "message"],
            "properties": {
              "code": {
                "type": "string",
                "description": "A stable machine identifier. Branch on this, never on the message."
              },
              "message": {
                "type": "string",
                "description": "The message in the language named by Accept-Language. The code is the stable value."
              },
              "data": {}
            }
          }
        }
      }
    },
    "responses": {
      "Error": {
        "description": "The error envelope every failure uses.",
        "headers": {
          "Content-Language": {
            "$ref": "#/components/headers/ContentLanguage"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorEnvelope"
            }
          }
        }
      }
    }
  }
}
