{
  "openapi": "3.1.0",
  "info": {
    "title": "Travel Code API",
    "version": "1.0.0",
    "description": "Complete reference for the Travel Code REST API.\n\n**Before building from scratch — check what we already integrate.** We maintain **200+ live integrations** with suppliers, accounting systems, payment processors, CRMs, and reporting tools. Browse the full catalogue at **https://travel-code.com/integrations** — if your system is there, you may not need to write anything custom.\n\n**Surface:** `/v1/*` — JSON, JWT/OAuth auth, unified order/booking lifecycle.\n\n**Auth tiers:**\n- None — search and lookups\n- JWT — server-to-server (single integrator account)\n- OAuth 2.0 + PKCE — third-party AI agents and MCP servers\n\n**Cache lifetimes:** every multi-supplier search step caches its result for 15 minutes. After expiration the search must be re-run.\n\n**Need a new integration?** We can build adapters for additional accounting systems, CRMs, or supplier feeds on request — reach out via your account manager.\n\n## Rate Guard — re-shopping for booked trips\n\n**Hotels — live.** Rate Guard keeps watching hotel bookings after they are confirmed. Every 6 hours it\nre-shops each refundable booking across our hotel suppliers for the same room with at least the same\nmeals and a rate that is still refundable. When it finds a cheaper one it either emails a one-click rebooking offer,\nor — within the savings thresholds and approval rules each\ncompany sets — books the new rate and cancels the old one by itself.\n\n**Flights — coming soon.**\n\n**API and webhooks are available on request.** Write to **support@travel-code.com** and we will send\nthe Rate Guard API documentation and set up webhooks for the events you need.",
    "contact": {
      "name": "Travel Code"
    }
  },
  "servers": [
    {
      "url": "https://api.travel-code.com",
      "description": "Production"
    }
  ],
  "tags": [
    {
      "name": "News",
      "description": "Article listing for content sync (super-admin)."
    },
    {
      "name": "Auth",
      "description": "JWT login + OAuth 2.0 (PKCE)."
    },
    {
      "name": "Data Lookups",
      "description": "Read-only autocompletes and code resolution. All unauthenticated."
    },
    {
      "name": "Hotel Search",
      "description": "Streamed search + cache-only list/map/search-names + per-hotel offers."
    },
    {
      "name": "Flight Search",
      "description": "Async fan-out: kick off, poll cacheId. Plus calendar + comparison table."
    },
    {
      "name": "Train Search",
      "description": "RailEurope, Distribusion, regional partners."
    },
    {
      "name": "Transfer Search",
      "description": "Synchronous — no cache step."
    },
    {
      "name": "Orders",
      "description": "Unified order lifecycle for all service types: create, list, details, cancel, modify."
    },
    {
      "name": "Wallet",
      "description": "Deposit-funded corporate accounts."
    },
    {
      "name": "Deposits",
      "description": "Accounting-side deposit ledger: read and top up a NAMED depositor's deposit balance. Unlike Wallet, which always answers about the caller's own account, these act on another company's wallet and are therefore restricted to accounting roles (an ordinary client token gets 403)."
    },
    {
      "name": "Accounting Sync",
      "description": "Gateway for syncing orders, payments, refunds, invoices, and reference data with external accounting systems. One endpoint, many actions — pick the operation via the `action` query parameter. Supported systems listed at travel-code.com/integrations; custom integrations on request."
    },
    {
      "name": "Risk Alerts",
      "description": "Real-time travel risk events worldwide — natural disasters, armed conflicts, severe weather, and government travel advisories. All endpoints are public (no auth required). Responses are cached server-side (alerts: 5 min, advisories/country: 1 h)."
    },
    {
      "name": "Travelers",
      "description": "Corporate trip participants — your saved tourists. List who is currently traveling, get full profile with passport and trip details, or send a safety check-in message via email, SMS, or push. All data is scoped to your account: you see only the tourists saved in your TravelCode profile."
    },
    {
      "name": "Clients",
      "description": "Saved client/contact directory — searchable pool of passenger profiles used for order pre-fill. Look up by first/last name to find existing records (with passport, birth date, contact info, nationality), then attach them to a new booking instead of duplicating. Scoped to your account; admins see all clients in the system."
    },
    {
      "name": "Cardholders",
      "description": "Virtual card holders. Required before issuing a virtual card."
    },
    {
      "name": "Virtual Cards",
      "description": "Issue, inspect, update and terminate virtual payment cards. PAN/CVV are returned only on creation and via the two-step OTP reveal."
    },
    {
      "name": "Travel Policy",
      "description": "Manage company travel policies and check offers against them"
    },
    {
      "name": "Users (service)",
      "description": "M2M user directory"
    },
    {
      "name": "Expenses",
      "description": "Personal employee expenses"
    },
    {
      "name": "Off-platform bookings",
      "description": "Trips your travellers booked **outside Travel Code** — directly with an airline or hotel, on another\nbooking tool, through a TMC. Send them here and they show up next to the bookings made in Travel Code:\nin the traveller's trips, in duty of care and traveller tracking, in reporting and in expense reports.\n\nA record is information only. It creates no order, takes no payment and changes no price.\n\n### Getting access\n\nCalls are made with a bearer token of a user in your company. For a server-to-server integration ask\n**api@travel-code.com** for an API token for a company administrator account. An OAuth access token or\na JWT of a signed-in user works the same way.\n\n### Who you can send bookings for\n\n| Caller | May record bookings for |\n|---|---|\n| Any user | themselves (`user_id` omitted) |\n| A user of your company | any traveller of the same company — pass their `user_id` |\n| A guest traveller | themselves only |\n\nA traveller from another company is refused with `403`. To find a traveller's `user_id`, call\n`GET /v1/users?q=<email>` as a company administrator or travel manager (API token, OAuth or JWT); the user's `id` is the\n`user_id`.\n\n### Sending the same booking twice\n\nThe API does not de-duplicate. Before creating, look the booking up by its confirmation number and update\nit if it is already there:\n\n1. `GET /v1/off-platform-bookings?confirmationNumber=ABC123`\n2. found → `PATCH /v1/off-platform-bookings/{id}` with what changed;\n   not found → `POST /v1/off-platform-bookings`.\n\nThe list only shows bookings the caller may see: their own, or the whole company for a company\nadministrator or travel manager. Use such an account for syncing.\n\n### What to put in `locations` and `details`\n\nWe keep both as sent. These keys are read by Travel Code:\n\n| Field | Key | Used for |\n|---|---|---|\n| `locations` | an **array**; `country` of the **first** item — a country name in any language or an ISO-2 code | Duty of care map and traveller list, the country filter. A booking whose country we cannot recognise stays off the map. |\n| `details` | `title` — supplier or booking name, e.g. `Hotel Adlon Kempinski` or `Lufthansa LH 2033` | Card title in the traveller's trips; supplier name in reporting |\n| `details` | `traveler` — the name as printed on the booking | Shown on the card, searchable with `travelerName` |\n| `details` | `note` — free text | Shown on the card |\n\nAny other keys (`city`, `flightNumber`, `roomType`, …) are stored and returned unchanged.\n\n### Currency\n\n`currency` is the ISO 4217 code of the currency the booking was paid in, any of them — `CHF`, `JPY`,\n`SEK` and so on. Lower case is accepted and stored in upper case. An unknown code is refused with `422`\nunder `currency`.\n\n### Linking to a Travel Code trip\n\nPass `order_id` to show the booking inside an existing trip (for example the hotel a traveller booked\nthemselves for a trip whose flights were booked with us). The trip must belong to the same company, and a\ncancelled trip cannot take new bookings (`422`)."
    },
    {
      "name": "Auto-approval rules",
      "description": "Approver-configured rules Robert applies to auto-approve trips (6.6)"
    },
    {
      "name": "Competitive offer",
      "description": "Match a competitor price to our offer; dynamic special price (6.3.3)"
    },
    {
      "name": "Categories",
      "description": "Spend categories (card-controls picker + expense management). Admin-managed."
    },
    {
      "name": "Airline Commissions",
      "description": "**A separate service from the booking API.** Airline commission programs that\nconsolidators (for example Hickory Global Partners) send as PDF grids are read automatically,\nnormalised to one JSON format and checked by our air department before they go live. Partners\nreceive the result in two ways:\n\n1. **Webhooks** — a signed `POST` to your endpoint when a program is published, replaced, about to\n   expire (14 days ahead) or expired.\n2. **Read API** — `GET /v1/airline-commissions/programs` returns every program in force right now.\n\nBoth carry the same **Commission Grid** program shape (schema version `1.0`): airlines, ticketing\nand travel dates, point of sale, tour code and where to put it, markets, and one rate per\norigin/destination × cabin × booking classes.\n\n**Access is granted by hand.** To connect, write to **api@travel-code.com** with your company\nname, the endpoint that should receive webhooks and the events you need. We create your API\ncredentials and webhook subscription and send you the signing secret. Without that, both\nendpoints answer `403`.\n\n### Verifying a webhook\n\nEvery delivery has these headers:\n\n| Header | Value |\n|---|---|\n| `X-Travel-Code-Event` | event name, e.g. `commission.program.published` |\n| `X-Travel-Code-Delivery` | delivery id, stable across retries — use it to de-duplicate |\n| `X-Travel-Code-Signature` | `t=<unix seconds>,v1=<hex HMAC-SHA256>` |\n\nCompute `HMAC_SHA256(secret, t + \".\" + rawBody)` and compare it with `v1` in constant time;\nreject the request if `t` is more than 5 minutes old. Answer any `2xx` within 15 seconds. Any other\nanswer or a timeout is retried, five attempts in total, then the delivery is marked failed.\nWe only deliver to public `https` endpoints on port 443 or 8443 and do not follow redirects.\n\n```python\nimport hmac, hashlib, time\ndef verify(secret, header, body):\n    parts = dict(p.split(\"=\", 1) for p in header.split(\",\"))\n    if abs(time.time() - int(parts[\"t\"])) > 300:\n        return False\n    expected = hmac.new(secret.encode(), f'{parts[\"t\"]}.'.encode() + body, hashlib.sha256).hexdigest()\n    return hmac.compare_digest(expected, parts[\"v1\"])\n```\n"
    },
    {
      "name": "Company Events",
      "description": "Company events: sales kickoffs, offsites, conferences, retreats and incentive trips. One workspace per event: the organizer team, participants and guests, the booking rules (travel window, services, hotels, approvals), in-event booking, hotel room blocks, the budget and event cards.\n\n**Access.** The company needs the Events module (`403`, code 130, when it is off). Rights are checked per event: `404` means the event is not visible to the caller, `403` means a right is missing. Directors, travel managers and employees marked as event organizers can create events. A participant sees their own part; a guest sees only their own invitation and trip.\n\n**Booking inside an event.** `POST /v1/events/{id}/context` makes the event the caller's booking context. From then on, search and booking through the regular endpoints follow the event's rules, and orders are linked to the event. `DELETE /v1/events/context` leaves it."
    },
    {
      "name": "Bus, Ferry & Tram Search",
      "description": "Asynchronous bus, ferry and tram search (Distribusion network). Same contract as Train Search: start with POST, poll the result by `cacheId`, add a fare with `POST /v1/cart/trains`."
    },
    {
      "name": "Car Rental Search",
      "description": "Asynchronous car rental search. Start with POST, poll by `cacheId`, add an offer with `POST /v1/cart/cars`."
    },
    {
      "name": "Cart",
      "description": "The caller's own cart, shared with the travel-code.com cart page. Used for services that are booked through the cart (trains, buses, ferries, trams, rental cars): add services, read the cart, then book it or send it for approval."
    },
    {
      "name": "Rate Guard",
      "description": "Hotel price-drop protection: settings for price-drop emails, automatic rebooking and approvals, and the money rebookings returned."
    },
    {
      "name": "CO2",
      "description": "Company CO2 emissions report, emission factors, climate goal and rail-instead-of-flight thresholds."
    },
    {
      "name": "Analytics",
      "description": "Company travel reporting: analytics reports (spend, CO2, policy health, per diem, contract fares, hotels), the order-registry feed for accounting systems, and statement / tax report downloads."
    }
  ],
  "x-tagGroups": [
    {
      "name": "REST API v1",
      "tags": [
        "Auth",
        "Data Lookups",
        "Hotel Search",
        "Flight Search",
        "Train Search",
        "Transfer Search",
        "Orders",
        "Wallet",
        "Deposits",
        "Accounting Sync",
        "Risk Alerts",
        "Travelers",
        "Clients",
        "Cardholders",
        "Virtual Cards",
        "Travel Policy",
        "Users (service)",
        "Expenses",
        "Company Events"
      ]
    },
    {
      "name": "Airline Commissions (partner service)",
      "tags": [
        "Airline Commissions"
      ]
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "JWT or OAuth bearer access token."
      },
      "newsApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-News-Api-Key",
        "description": "Shared secret for the machine-to-machine /v1/news/by-slug lookup. Not a user token."
      },
      "oauth2": {
        "type": "oauth2",
        "description": "OAuth 2.0 authorization-code flow with PKCE.",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://travel-code.com/oauth/authorize",
            "tokenUrl": "https://travel-code.com/oauth/token",
            "refreshUrl": "https://travel-code.com/oauth/token",
            "scopes": {
              "flights:search": "Search flights",
              "flights:status": "Flight status lookups",
              "flights:stats": "Flight statistics",
              "airports:read": "Read airports",
              "airlines:read": "Read airlines",
              "orders:read": "View your orders",
              "orders:write": "Create, change and cancel orders"
            }
          }
        }
      }
    },
    "responses": {
      "ErrorEnvelope": {
        "description": "Standard error envelope.",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string",
                      "example": "OFFER_EXPIRED"
                    },
                    "message": {
                      "type": "string"
                    },
                    "details": {
                      "type": [
                        "object",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      },
      "NotFound": {
        "description": "Resource not found."
      },
      "EventsForbidden": {
        "description": "The Events module is off for the company (code 130), or the caller can see the event but lacks the permission (code 6).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/EventsError"
            }
          }
        }
      },
      "EventsNotFound": {
        "description": "The event or member does not exist, or the event is not visible to the caller (code 5).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/EventsError"
            }
          }
        }
      },
      "EventsUnauthorized": {
        "description": "Missing or invalid Bearer token.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/EventsError"
            }
          }
        }
      },
      "EventsValidationError": {
        "description": "Validation failed.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/EventsValidationErrors"
            }
          }
        }
      }
    },
    "schemas": {
      "Counterparty": {
        "type": "object",
        "description": "A counterparty in the bank-payment auto-match directory, keyed by tax id (UNP/INN).",
        "properties": {
          "id": {
            "type": "string",
            "description": "Source-namespaced id (cp:/agency:/partner:)."
          },
          "taxId": {
            "type": [
              "string",
              "null"
            ],
            "description": "UNP (BY, 9 digits) or INN (RU, 10-12 digits), digits only; null for individuals."
          },
          "taxIdType": {
            "type": "string",
            "enum": [
              "UNP",
              "INN",
              "OTHER",
              "NONE"
            ]
          },
          "kpp": {
            "type": [
              "string",
              "null"
            ],
            "description": "KPP (RU only)."
          },
          "name": {
            "type": "string",
            "description": "Legal name."
          },
          "aliases": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Alternative spellings seen in bank statements."
          },
          "role": {
            "type": "string",
            "enum": [
              "client",
              "supplier",
              "own_entity",
              "partner",
              "bank",
              "government_tax",
              "passthrough",
              "other"
            ],
            "description": "Drives how a transaction is interpreted (income / expense / internal transfer / tax)."
          },
          "country": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISO-2 country code."
          },
          "active": {
            "type": "boolean"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Guests": {
        "type": "array",
        "description": "Per-room/per-coach occupancy.",
        "items": {
          "type": "object",
          "required": [
            "adults"
          ],
          "properties": {
            "adults": {
              "type": "integer",
              "minimum": 1,
              "maximum": 4,
              "description": "1–4 per room"
            },
            "children": {
              "type": "integer",
              "minimum": 0,
              "maximum": 3
            },
            "childrenAges": {
              "type": "array",
              "items": {
                "type": "integer",
                "minimum": 0,
                "maximum": 17
              }
            }
          }
        },
        "example": [
          {
            "adults": 2,
            "children": 1,
            "childrenAges": [
              5
            ]
          }
        ]
      },
      "HotelFilter": {
        "type": "object",
        "properties": {
          "minPrice": {
            "type": "integer",
            "description": "Min nightly price in site currency (converted to USD server-side)."
          },
          "maxPrice": {
            "type": "integer",
            "description": "Max nightly price."
          },
          "starRating[]": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 1,
              "maximum": 5
            }
          },
          "boards[]": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "RO",
                "BI",
                "LI",
                "DI",
                "HB",
                "FB",
                "AI"
              ]
            },
            "description": "Meal plan codes."
          },
          "payments": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ],
            "description": "Use `full_refund` to require a fully refundable rate."
          },
          "propertyTypes[]": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "hotel, aparthotel, apartment, hostel, guesthouse, bed_and_breakfast, resort, villa, motel, bungalow, inn, country_house, holiday_park, camping, boutique, capsule, specialty."
          }
        }
      },
      "Passenger": {
        "type": "object",
        "description": "Flight / train passenger.",
        "required": [
          "firstName",
          "lastName",
          "dateOfBirth",
          "gender",
          "nationality",
          "document"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "adult",
              "child",
              "infant"
            ],
            "description": "Optional; derived from age on the flight date (12+ adult, 2–11 child, <2 infant)."
          },
          "firstName": {
            "type": "string",
            "description": "Latin, exactly as in the passport."
          },
          "lastName": {
            "type": "string",
            "description": "Latin, exactly as in the passport."
          },
          "gender": {
            "type": "string",
            "enum": [
              "M",
              "F"
            ]
          },
          "dateOfBirth": {
            "type": "string",
            "format": "date",
            "description": "`YYYY-MM-DD` or `DD.MM.YYYY`. The field is `dateOfBirth`, not `birthDate`."
          },
          "nationality": {
            "type": "string",
            "example": "US",
            "description": "ISO-3166 alpha-2. **Always send it**: when it is missing the server falls back to `BY` and the airline gets a wrong nationality."
          },
          "contacts": {
            "type": "object",
            "properties": {
              "email": {
                "type": "string",
                "format": "email"
              },
              "phone": {
                "type": "string",
                "example": "+1 305 555 0100",
                "description": "International format with the country code (`+<code> <number>`). Amadeus rejects a booking without a calling code. For flights the first passenger's phone is the booking contact; without it the caller's account phone is used."
              }
            }
          },
          "document": {
            "type": "object",
            "required": [
              "number"
            ],
            "description": "Travel document. Required for flights; for hotels optional.",
            "properties": {
              "type": {
                "type": "string",
                "default": "PASSPORT",
                "example": "PASSPORT"
              },
              "number": {
                "type": "string",
                "example": "PD0000000",
                "description": "Full number. Masked numbers (`PD*****37`) from `/v1/user/recent-travelers` are rejected — read the full one from `GET /v1/clients/{id}/documents`."
              },
              "expiryDate": {
                "type": "string",
                "format": "date",
                "description": "`YYYY-MM-DD` (flights also accept `DD.MM.YYYY`). The field is `expiryDate`, not `expiry`."
              },
              "issuedAt": {
                "type": "string",
                "format": "date",
                "description": "`YYYY-MM-DD`, optional."
              },
              "nationality": {
                "type": "string",
                "example": "US",
                "description": "Issuing country, ISO-3166 alpha-2. Defaults to the passenger's `nationality`."
              }
            }
          }
        }
      },
      "RoomGuests": {
        "type": "object",
        "required": [
          "guests"
        ],
        "properties": {
          "guests": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/HotelGuest"
            }
          },
          "specialRequest": {
            "type": "string"
          }
        }
      },
      "RiskAlert": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "alert_type": {
            "type": "string",
            "enum": [
              "earthquake",
              "wildfire",
              "flood",
              "cyclone",
              "volcano",
              "drought",
              "severe_storm",
              "armed_conflict",
              "humanitarian",
              "other"
            ]
          },
          "severity": {
            "type": "string",
            "enum": [
              "Low",
              "Medium",
              "High",
              "Critical"
            ]
          },
          "country_iso": {
            "type": [
              "string",
              "null"
            ],
            "example": "TUR",
            "description": "ISO 3166-1 alpha-3. Null when location is international waters or unresolvable."
          },
          "location": {
            "type": "string"
          },
          "latitude": {
            "type": "number",
            "format": "float"
          },
          "longitude": {
            "type": "number",
            "format": "float"
          },
          "description": {
            "type": "string"
          },
          "event_date": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "source": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "gdacs",
              "usgs",
              "eonet",
              "nws",
              "reliefweb",
              null
            ]
          },
          "external_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "polygon": {
            "type": [
              "array",
              "null"
            ],
            "description": "Affected area perimeter. Array of [longitude, latitude] pairs (GeoJSON convention).",
            "items": {
              "type": "array",
              "items": {
                "type": "number"
              },
              "minItems": 2,
              "maxItems": 2
            }
          }
        }
      },
      "TravelRiskCountry": {
        "type": "object",
        "properties": {
          "iso_code": {
            "type": "string",
            "example": "DEU"
          },
          "name": {
            "type": "string",
            "example": "Germany"
          },
          "advisory_level": {
            "type": "integer",
            "minimum": 1,
            "maximum": 4
          },
          "advisory_description": {
            "type": "string"
          },
          "advisory_date": {
            "type": "string",
            "format": "date"
          },
          "risk_score": {
            "type": "number",
            "description": "Composite risk score 0–100."
          },
          "last_updated": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "TravelRiskScore": {
        "type": "object",
        "properties": {
          "iso_code": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "risk_score": {
            "type": "number"
          },
          "advisory_level": {
            "type": "integer",
            "minimum": 1,
            "maximum": 4
          },
          "active_alerts": {
            "type": "integer"
          },
          "calculation": {
            "type": "object",
            "properties": {
              "base_score": {
                "type": "number"
              },
              "alert_impact": {
                "type": "number"
              },
              "composite": {
                "type": "number"
              }
            }
          }
        }
      },
      "ConflictEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "external_id": {
            "type": "string"
          },
          "event_code": {
            "type": "string"
          },
          "event_root_code": {
            "type": "string",
            "enum": [
              "17",
              "18",
              "19",
              "20"
            ],
            "description": "GDELT root event code (17=Coerce, 18=Assault, 19=Fight, 20=Mass violence)."
          },
          "country_iso": {
            "type": [
              "string",
              "null"
            ]
          },
          "location": {
            "type": "string"
          },
          "latitude": {
            "type": "number"
          },
          "longitude": {
            "type": "number"
          },
          "description": {
            "type": "string"
          },
          "event_date": {
            "type": "string",
            "format": "date-time"
          },
          "num_mentions": {
            "type": "integer",
            "description": "Number of news sources mentioning the event."
          },
          "severity": {
            "type": "string",
            "enum": [
              "Critical",
              "High",
              "Medium"
            ]
          },
          "source_url": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "ConflictFilters": {
        "type": "object",
        "properties": {
          "days": {
            "type": [
              "integer",
              "null"
            ]
          },
          "country": {
            "type": [
              "string",
              "null"
            ]
          },
          "min_severity": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "AdvisorySource": {
        "type": "object",
        "properties": {
          "agency": {
            "type": "string",
            "enum": [
              "US",
              "UK",
              "CA"
            ]
          },
          "level": {
            "type": "integer",
            "minimum": 1,
            "maximum": 4
          },
          "summary_label": {
            "type": "string",
            "example": "Exercise Increased Caution"
          },
          "url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "CountryAdvisory": {
        "type": "object",
        "properties": {
          "iso_code": {
            "type": "string",
            "example": "IRN"
          },
          "name": {
            "type": "string"
          },
          "max_level": {
            "type": "integer",
            "minimum": 1,
            "maximum": 4,
            "description": "Highest level across all agency advisories. 1=Exercise Normal Caution, 2=Exercise Increased Caution, 3=Reconsider Travel, 4=Do Not Travel."
          },
          "summary_label": {
            "type": "string"
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AdvisorySource"
            }
          }
        }
      },
      "Traveler": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "oc-123",
            "description": "Traveler ID. Use this value in `get_traveler` and `contact_travelers`."
          },
          "name": {
            "type": "string",
            "example": "Anna Schmidt"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "phone": {
            "type": "string",
            "example": "+49 151 234567",
            "description": "Free-form booking phone, not E.164-normalised."
          },
          "role": {
            "type": "string",
            "example": "passenger"
          },
          "initials": {
            "type": "string",
            "example": "AS"
          },
          "city": {
            "type": "string",
            "example": "Berlin"
          },
          "country_iso": {
            "type": [
              "string",
              "null"
            ],
            "example": "DEU",
            "description": "ISO 3166-1 alpha-3 current country."
          },
          "latitude": {
            "type": [
              "number",
              "null"
            ],
            "format": "float"
          },
          "longitude": {
            "type": [
              "number",
              "null"
            ],
            "format": "float"
          },
          "trip_start": {
            "type": "string",
            "format": "date",
            "example": "2026-05-20"
          },
          "trip_end": {
            "type": "string",
            "format": "date",
            "example": "2026-05-27"
          },
          "status": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "in_transit",
              "at_destination",
              "returning",
              "checking_in",
              null
            ]
          }
        }
      },
      "TripService": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "example": "hotel",
            "description": "Service type: hotel, flight, train, transfer, etc."
          },
          "title": {
            "type": "string",
            "example": "Hilton Dubai"
          },
          "date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "duration_days": {
            "type": [
              "integer",
              "null"
            ]
          },
          "country_iso": {
            "type": [
              "string",
              "null"
            ],
            "example": "ARE"
          },
          "city": {
            "type": "string",
            "example": "Dubai"
          }
        }
      },
      "TravelerDetails": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Traveler"
          },
          {
            "type": "object",
            "properties": {
              "passport_number": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "passport_expire_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              },
              "birth_day": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              },
              "nationality": {
                "type": [
                  "string",
                  "null"
                ],
                "example": "DEU",
                "description": "ISO 3166-1 alpha-3 nationality."
              },
              "current_trip": {
                "type": "object",
                "properties": {
                  "order_id": {
                    "type": "integer"
                  },
                  "order_status": {
                    "type": "string"
                  },
                  "services": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/TripService"
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "Client": {
        "type": "object",
        "description": "Saved client profile (short form). Use the `id` in `get_client` for the full record including passport documents.",
        "properties": {
          "id": {
            "type": "integer",
            "example": 12345
          },
          "userId": {
            "type": "integer",
            "description": "Internal owner ID of the client record."
          },
          "firstName": {
            "type": "string",
            "example": "Andrei"
          },
          "lastName": {
            "type": "string",
            "example": "Zanevsky"
          },
          "patronymicName": {
            "type": "string"
          },
          "firstNameEn": {
            "type": "string",
            "example": "Andrei"
          },
          "lastNameEn": {
            "type": "string",
            "example": "Zanevsky"
          },
          "birthDay": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "example": "1990-05-12"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "phone": {
            "type": "string",
            "example": "+375 29 1234567"
          },
          "sex": {
            "type": "string",
            "enum": [
              "male",
              "female"
            ]
          },
          "nationality": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Country ID — resolve via `/v1/data/countries`."
          },
          "country": {
            "type": [
              "string",
              "null"
            ],
            "description": "Localised country title.",
            "example": "Belarus"
          }
        }
      },
      "ClientDocument": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "kind": {
            "type": "string",
            "example": "PASSPORT"
          },
          "number": {
            "type": "string",
            "example": "MP1234567"
          },
          "issuedBy": {
            "type": "string"
          },
          "issuedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "expireAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          }
        }
      },
      "ClientMembership": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "type": {
            "type": "string",
            "description": "Loyalty program type (e.g. airline, hotel)."
          },
          "programId": {
            "type": [
              "integer",
              "null"
            ]
          },
          "number": {
            "type": "string"
          },
          "isDefault": {
            "type": "boolean"
          }
        }
      },
      "ClientDetails": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Client"
          },
          {
            "type": "object",
            "properties": {
              "docs": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ClientDocument"
                }
              },
              "memberships": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ClientMembership"
                }
              }
            }
          }
        ]
      },
      "ContactTravelersRequest": {
        "type": "object",
        "required": [
          "traveler_ids",
          "channel",
          "template"
        ],
        "properties": {
          "traveler_ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "oc-123",
              "oc-456"
            ],
            "description": "IDs from the `list_travelers` response."
          },
          "channel": {
            "type": "string",
            "enum": [
              "email",
              "sms",
              "push"
            ]
          },
          "template": {
            "type": "string",
            "enum": [
              "safety_check_in",
              "evacuation_advisory",
              "custom"
            ],
            "description": "`custom` requires `custom_message`."
          },
          "custom_message": {
            "type": "string",
            "description": "Required when `template` is `custom`.",
            "example": "Please confirm your current location."
          }
        }
      },
      "ContactTravelersResponse": {
        "type": "object",
        "properties": {
          "sent": {
            "type": "integer",
            "description": "Number of successfully sent messages."
          },
          "failed": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "example": "oc-789"
                },
                "reason": {
                  "type": "string",
                  "example": "not_accessible",
                  "description": "not_accessible | no_email | no_phone | send_failed | channel_not_implemented"
                }
              }
            }
          },
          "fetched_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "MonetaryAmount": {
        "type": "object",
        "properties": {
          "value": {
            "type": "number",
            "example": 1000.0
          },
          "currency": {
            "type": "string",
            "example": "USD"
          }
        }
      },
      "BillingAddress": {
        "type": "object",
        "properties": {
          "country": {
            "type": "string",
            "example": "USA"
          },
          "state": {
            "type": "string",
            "example": "FL"
          },
          "city": {
            "type": "string",
            "example": "St. Petersburg"
          },
          "streetName": {
            "type": "string",
            "example": "4th St N"
          },
          "streetNumber": {
            "type": "string",
            "example": "7901"
          },
          "streetAdditional": {
            "type": "string",
            "example": "STE 300"
          },
          "postalCode": {
            "type": "string",
            "example": "33702"
          }
        }
      },
      "Cardholder": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Cardholder UUID",
            "example": "08a52378-9357-4b66-b6de-2a7f492fdc99"
          },
          "firstName": {
            "type": "string"
          },
          "lastName": {
            "type": "string"
          },
          "fullName": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "phone": {
            "type": [
              "string",
              "null"
            ],
            "example": "+16467228331"
          },
          "language": {
            "type": [
              "string",
              "null"
            ],
            "example": "EN"
          },
          "nationality": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISO 3166-1 alpha-2",
            "example": "US"
          },
          "dateOfBirth": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "INACTIVE",
              "DEACTIVATED",
              "INVITED"
            ]
          }
        }
      },
      "CardholderCreateRequest": {
        "type": "object",
        "required": [
          "firstName",
          "lastName",
          "email",
          "phone",
          "dateOfBirth"
        ],
        "properties": {
          "firstName": {
            "type": "string"
          },
          "lastName": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "format": "email",
            "description": "Must be unique among ACTIVE cardholders."
          },
          "phone": {
            "type": "string",
            "example": "+16467228331"
          },
          "nationality": {
            "type": "string",
            "description": "ISO 3166-1 alpha-2",
            "example": "US"
          },
          "dateOfBirth": {
            "type": "string",
            "format": "date",
            "example": "1990-05-21"
          }
        }
      },
      "CardSensitiveData": {
        "type": "object",
        "description": "PCI data. Never stored on our side; do not log or cache on the client.",
        "properties": {
          "pan": {
            "type": "string",
            "example": "5555444433331234"
          },
          "cvv": {
            "type": "string",
            "example": "123"
          },
          "expiryMonth": {
            "type": "string",
            "example": "08"
          },
          "expiryYear": {
            "type": "string",
            "example": "2026"
          }
        }
      },
      "VirtualCard": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Card UUID",
            "example": "0a1b2c3d-4e5f-6071-8293-a4b5c6d7e8f9"
          },
          "cardholderId": {
            "type": "string"
          },
          "cardConfig": {
            "type": "string",
            "example": "PLIANT_VIRTUAL_TRAVEL_US"
          },
          "label": {
            "type": [
              "string",
              "null"
            ]
          },
          "purpose": {
            "type": [
              "string",
              "null"
            ]
          },
          "limit": {
            "$ref": "#/components/schemas/MonetaryAmount"
          },
          "transactionLimit": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MonetaryAmount"
              },
              {
                "type": "null"
              }
            ]
          },
          "maxTransactionCount": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Max number of transactions allowed on the card. null for cards issued before this field existed."
          },
          "maskedPan": {
            "type": [
              "string",
              "null"
            ],
            "example": "••••1234"
          },
          "expiryDate": {
            "type": [
              "string",
              "null"
            ]
          },
          "customFirstName": {
            "type": [
              "string",
              "null"
            ]
          },
          "customLastName": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "ACTIVE",
              "USED",
              "TERMINATED",
              "EXPIRED",
              "LOCKED"
            ],
            "description": "PENDING = issued asynchronously (sanction screening), PAN/CVV not available until the provider activates it (card flips to ACTIVE)."
          },
          "orderId": {
            "type": [
              "integer",
              "null"
            ]
          },
          "orderServiceId": {
            "type": [
              "integer",
              "null"
            ]
          },
          "usedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "terminatedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string"
          }
        }
      },
      "VirtualCardWithSensitive": {
        "allOf": [
          {
            "$ref": "#/components/schemas/VirtualCard"
          },
          {
            "type": "object",
            "properties": {
              "sensitive": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/CardSensitiveData"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "null for async (PENDING) cards — fetch later via the two-step reveal after activation."
              },
              "cardholder": {
                "$ref": "#/components/schemas/Cardholder"
              },
              "address": {
                "$ref": "#/components/schemas/BillingAddress"
              }
            }
          }
        ]
      },
      "VirtualCardWithScope": {
        "allOf": [
          {
            "$ref": "#/components/schemas/VirtualCard"
          },
          {
            "type": "object",
            "properties": {
              "cardholder": {
                "$ref": "#/components/schemas/Cardholder"
              },
              "address": {
                "$ref": "#/components/schemas/BillingAddress"
              },
              "controls": {
                "description": "Present only with ?scope=controls; null when the card has no controls.",
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/CardControlsView"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          }
        ]
      },
      "VirtualCardCreateRequest": {
        "type": "object",
        "required": [
          "cardholderId",
          "cardConfig",
          "limitValue",
          "limitCurrency"
        ],
        "properties": {
          "cardholderId": {
            "type": "string",
            "description": "Existing ACTIVE cardholder in your environment."
          },
          "cardConfig": {
            "type": "string",
            "description": "A `cardConfig` value from GET /v1/virtual-cards/configs.",
            "example": "PLIANT_VIRTUAL_TRAVEL_US"
          },
          "limitValue": {
            "type": "number",
            "minimum": 0.01,
            "example": 1000
          },
          "limitCurrency": {
            "type": "string",
            "description": "ISO 4217",
            "example": "USD"
          },
          "validityPeriod": {
            "type": "integer",
            "minimum": 1,
            "description": "Validity in months."
          },
          "maxTransactionCount": {
            "type": "integer",
            "minimum": 1,
            "description": "Max number of transactions allowed before the card is declined. Optional; defaults to 5."
          },
          "label": {
            "type": "string"
          },
          "purpose": {
            "type": "string"
          },
          "customFirstName": {
            "type": "string",
            "maxLength": 50,
            "description": "Name printed on the card. Provide together with customLastName. Allowed charset: A-Za-z0-9äöüÄÖÜ.-. Applied only when issuing under a technical/shared cardholder; ignored for a personal cardholder."
          },
          "customLastName": {
            "type": "string",
            "maxLength": 50,
            "description": "Surname printed on the card. See customFirstName."
          },
          "orderId": {
            "type": "integer",
            "description": "Link the card to an order."
          },
          "orderServiceId": {
            "type": "integer",
            "description": "Link the card to an order service."
          },
          "cardAccountId": {
            "type": "string",
            "description": "UUID of the org card account (from GET /v1/virtual-cards/card-accounts). Determines the card's funding account and therefore its currency. Optional — if omitted, the provider falls back to the organization's default account."
          },
          "controls": {
            "$ref": "#/components/schemas/CardControls",
            "description": "Optional card restrictions applied at issuance. See CardControls."
          }
        },
        "description": " Optional `controls` apply card restrictions (categories/merchants/dates/times/locations/countries/currencies/acceptanceMethods) at issuance; validated before the provider (400, field keys like controls.categories.values)."
      },
      "VirtualCardUpdateRequest": {
        "type": "object",
        "description": "Provide at least one of: status, limitValue. status and limit can be changed in one request. `controls` replaces the card controls entirely (send the complete desired set; missing groups are removed). status/limit/controls may be combined in one request.",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "LOCKED"
            ],
            "description": "ACTIVE = unlock, LOCKED = lock."
          },
          "limitValue": {
            "type": "number",
            "minimum": 0.01,
            "description": "New total limit. Requires limitCurrency."
          },
          "limitCurrency": {
            "type": "string",
            "description": "Must match the card's currency."
          },
          "maxTransactionCount": {
            "type": "integer",
            "minimum": 1,
            "maximum": 999999999,
            "description": "New max number of transactions (1..999999999). Can be changed independently of the amount."
          },
          "controls": {
            "$ref": "#/components/schemas/CardControls",
            "description": "Full desired set of card controls applied to the card. REPLACE semantics: groups not present are removed. At least one of status / limitValue / controls must be provided."
          }
        }
      },
      "VirtualCardConfig": {
        "type": "object",
        "properties": {
          "cardConfig": {
            "type": "string",
            "description": "Key passed to POST /v1/virtual-cards.",
            "example": "PLIANT_VIRTUAL_TRAVEL_US"
          },
          "name": {
            "type": "string",
            "description": "Ready-to-display title."
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "description": "Ready-to-display description."
          },
          "type": {
            "type": "string",
            "example": "VIRTUAL"
          },
          "country": {
            "type": "string",
            "example": "US"
          },
          "fundingType": {
            "type": "string",
            "example": "PREFUNDED"
          },
          "maxTransactions": {
            "type": [
              "integer",
              "null"
            ]
          },
          "expiryPeriodsInMonths": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "description": "Allowed validityPeriod values for this config."
          },
          "imagePath": {
            "type": "string",
            "description": "CDN path to the card image."
          },
          "isDomestic": {
            "type": "boolean",
            "description": "Domestic (US-only) config; new cardholders for it usually need nationality/dateOfBirth."
          },
          "requiresSanctionScreening": {
            "type": "boolean",
            "description": "When true, this config is issued asynchronously via sanction screening: POST /v1/virtual-cards returns the card in PENDING state with no PAN/CVV, and it becomes usable (and revealable) only after the provider activates it."
          }
        }
      },
      "RevealRequestAccepted": {
        "type": "object",
        "properties": {
          "otpSent": {
            "type": "boolean",
            "example": true
          }
        }
      },
      "VirtualCardReveal": {
        "allOf": [
          {
            "$ref": "#/components/schemas/VirtualCard"
          },
          {
            "type": "object",
            "properties": {
              "sensitive": {
                "$ref": "#/components/schemas/CardSensitiveData"
              },
              "cardholder": {
                "$ref": "#/components/schemas/Cardholder"
              },
              "address": {
                "$ref": "#/components/schemas/BillingAddress"
              }
            }
          }
        ]
      },
      "CardholderList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Cardholder"
            }
          },
          "pagination": {
            "type": "object",
            "properties": {
              "offset": {
                "type": "integer"
              },
              "limit": {
                "type": "integer"
              },
              "total": {
                "type": "integer"
              }
            }
          },
          "fetched_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "VirtualCardList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VirtualCard"
            }
          },
          "pagination": {
            "type": "object",
            "properties": {
              "offset": {
                "type": "integer"
              },
              "limit": {
                "type": "integer"
              },
              "total": {
                "type": "integer"
              }
            }
          },
          "fetched_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CardAccount": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Card account UUID — pass as `cardAccountId` when creating a card.",
            "example": "76844e45-565b-46a9-9527-3759a3561972"
          },
          "name": {
            "type": "string",
            "example": "USD account"
          },
          "status": {
            "type": "string",
            "example": "ACTIVE"
          },
          "currency": {
            "type": "string",
            "description": "Fixed currency for any card issued under this account.",
            "example": "USD"
          },
          "defaultAccount": {
            "type": "boolean",
            "description": "True for the organization's default account. The provider uses it if `cardAccountId` is omitted on card creation."
          }
        }
      },
      "CardholderUpdateRequest": {
        "type": "object",
        "description": "All fields optional; provide only what changes. A provided field must be non-empty.",
        "properties": {
          "firstName": {
            "type": "string"
          },
          "lastName": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "phone": {
            "type": "string",
            "example": "+16467228331"
          },
          "language": {
            "type": "string",
            "example": "en"
          },
          "salutation": {
            "type": "string"
          },
          "nationality": {
            "type": "string",
            "description": "ISO 3166-1 alpha-2",
            "example": "US"
          },
          "dateOfBirth": {
            "type": "string",
            "format": "date",
            "example": "1990-05-21"
          }
        }
      },
      "RecommendedConfig": {
        "type": "object",
        "properties": {
          "cardConfig": {
            "type": "string",
            "description": "Key to pass to POST /v1/virtual-cards."
          },
          "short": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "keepRateBps": {
            "type": "integer",
            "description": "Net keep rate in basis points."
          },
          "interchangeRate": {
            "type": [
              "number",
              "null"
            ],
            "description": "Fraction (0.03 = 3%)."
          },
          "netCashback": {
            "type": [
              "number",
              "null"
            ],
            "description": "Fraction (0.03 = 3%)."
          },
          "matchedMerchant": {
            "type": [
              "string",
              "null"
            ]
          },
          "matchType": {
            "type": "string",
            "description": "exact | category-fallback | default."
          }
        }
      },
      "VirtualCardTransaction": {
        "type": "object",
        "properties": {
          "transactionId": {
            "type": "string"
          },
          "cardId": {
            "type": "string"
          },
          "maskedPan": {
            "type": [
              "string",
              "null"
            ]
          },
          "cardholderId": {
            "type": [
              "string",
              "null"
            ]
          },
          "merchantName": {
            "type": [
              "string",
              "null"
            ]
          },
          "type": {
            "type": "string",
            "example": "PURCHASE"
          },
          "status": {
            "type": "string",
            "example": "CONFIRMED",
            "description": "PENDING | CONFIRMED | DECLINED | REVERSED | BOOKED."
          },
          "amount": {
            "type": "object",
            "properties": {
              "value": {
                "type": "number"
              },
              "currency": {
                "type": "string"
              }
            }
          },
          "declineReasonType": {
            "type": [
              "string",
              "null"
            ]
          },
          "source": {
            "type": [
              "string",
              "null"
            ]
          },
          "orderId": {
            "type": [
              "integer",
              "null"
            ]
          },
          "paymentOrderId": {
            "type": [
              "integer",
              "null"
            ]
          },
          "transactionDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "confirmationDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "card": {
            "description": "Present only with embedded=card.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/VirtualCard"
              },
              {
                "type": "null"
              }
            ]
          },
          "cardholder": {
            "description": "Present only with embedded=cardholder.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/Cardholder"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "VirtualCardTransactionList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VirtualCardTransaction"
            }
          },
          "pagination": {
            "type": "object",
            "properties": {
              "offset": {
                "type": "integer"
              },
              "limit": {
                "type": "integer"
              },
              "total": {
                "type": "integer"
              }
            }
          },
          "fetched_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OrganizationBalance": {
        "type": "object",
        "description": "Wallet balance of the caller's organization. Each field is a money object ({value, currency}), or null if the provider did not return it.",
        "properties": {
          "creditLimit": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MonetaryAmount"
              },
              {
                "type": "null"
              }
            ],
            "description": "Total credit line."
          },
          "availableLimit": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MonetaryAmount"
              },
              {
                "type": "null"
              }
            ],
            "description": "Currently available to spend."
          },
          "balance": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MonetaryAmount"
              },
              {
                "type": "null"
              }
            ],
            "description": "Current balance."
          }
        }
      },
      "CardControlGroup": {
        "type": "object",
        "description": "One card-controls restriction group. ALLOWED = whitelist (only listed allowed), BLOCKED = blacklist (listed denied).",
        "required": [
          "values",
          "restriction"
        ],
        "properties": {
          "type": {
            "type": "string",
            "description": "Group type where applicable: CATEGORY|MCC (categories), MATCH_TERM (merchants), FIXED|WEEKLY|MONTHLY|YEARLY (dates), TIMERANGE (times), POSTAL_CODE|REGION (locations), ACCEPTANCE_METHOD (acceptanceMethods). Omitted for countries/currencies."
          },
          "values": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Non-empty list of group values."
          },
          "restriction": {
            "type": "string",
            "enum": [
              "ALLOWED",
              "BLOCKED"
            ],
            "description": "acceptanceMethods supports ALLOWED only."
          },
          "timezone": {
            "type": "string",
            "description": "IANA timezone. Required for dates and times.",
            "example": "Europe/Berlin"
          }
        }
      },
      "CardControls": {
        "type": "object",
        "description": "Card restrictions applied at issuance. Each group is independent and optional; send only the ones you need. Value dictionaries: GET /v1/virtual-cards/control-options.",
        "properties": {
          "categories": {
            "$ref": "#/components/schemas/CardControlGroup"
          },
          "merchants": {
            "$ref": "#/components/schemas/CardControlGroup"
          },
          "dates": {
            "$ref": "#/components/schemas/CardControlGroup"
          },
          "times": {
            "$ref": "#/components/schemas/CardControlGroup"
          },
          "locations": {
            "$ref": "#/components/schemas/CardControlGroup"
          },
          "countries": {
            "$ref": "#/components/schemas/CardControlGroup"
          },
          "currencies": {
            "$ref": "#/components/schemas/CardControlGroup"
          },
          "acceptanceMethods": {
            "$ref": "#/components/schemas/CardControlGroup"
          }
        }
      },
      "ControlOptions": {
        "type": "object",
        "description": "Static reference dictionaries for building the card-controls UI. Each dictionary (except timezones) is a list of { value, label } pairs.",
        "properties": {
          "restrictions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LabeledOption"
            }
          },
          "categories": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LabeledOption"
            }
          },
          "categoryTypes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LabeledOption"
            }
          },
          "merchants": {
            "type": "object",
            "properties": {
              "types": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/LabeledOption"
                }
              }
            }
          },
          "dates": {
            "type": "object",
            "properties": {
              "types": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/LabeledOption"
                }
              }
            }
          },
          "times": {
            "type": "object",
            "properties": {
              "types": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/LabeledOption"
                }
              }
            }
          },
          "locations": {
            "type": "object",
            "properties": {
              "types": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/LabeledOption"
                }
              }
            }
          },
          "currencies": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LabeledOption"
            }
          },
          "acceptanceMethods": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LabeledOption"
            }
          },
          "timezones": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Flat list of supported IANA timezone names."
          }
        }
      },
      "LabeledOption": {
        "type": "object",
        "description": "Dictionary entry: value sent to the API + a human label (English source lexeme; the UI may localize).",
        "properties": {
          "value": {
            "type": "string"
          },
          "label": {
            "type": "string"
          }
        }
      },
      "CardControlGroupView": {
        "type": "object",
        "description": "One control group as returned by the API (display form). Free-form values (merchants, locations, ranges, country codes, MCC) carry label == value.",
        "properties": {
          "type": {
            "$ref": "#/components/schemas/LabeledOption"
          },
          "restriction": {
            "$ref": "#/components/schemas/LabeledOption"
          },
          "values": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LabeledOption"
            }
          },
          "timezone": {
            "type": "string",
            "description": "IANA timezone (dates/times groups only)."
          }
        }
      },
      "CardControlsView": {
        "type": "object",
        "description": "Active card controls in display form (value/label). Only the groups that are set are present. Returned by GET /v1/virtual-cards/{id}?scope=controls.",
        "properties": {
          "categories": {
            "$ref": "#/components/schemas/CardControlGroupView"
          },
          "merchants": {
            "$ref": "#/components/schemas/CardControlGroupView"
          },
          "dates": {
            "$ref": "#/components/schemas/CardControlGroupView"
          },
          "times": {
            "$ref": "#/components/schemas/CardControlGroupView"
          },
          "locations": {
            "$ref": "#/components/schemas/CardControlGroupView"
          },
          "countries": {
            "$ref": "#/components/schemas/CardControlGroupView"
          },
          "currencies": {
            "$ref": "#/components/schemas/CardControlGroupView"
          },
          "acceptanceMethods": {
            "$ref": "#/components/schemas/CardControlGroupView"
          }
        }
      },
      "WebhookSubscription": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Pliant subscription id."
          },
          "eventType": {
            "type": "string",
            "description": "Event type (see the events catalog)."
          },
          "callbackUrl": {
            "type": "string",
            "format": "uri",
            "description": "Your HTTPS receiver the event is delivered to."
          }
        }
      },
      "SubscriptionEventsCatalog": {
        "type": "object",
        "description": "Subscribable event types grouped by entity.",
        "properties": {
          "transactions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "cards": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "cardholders": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "card-controls": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "SubscriptionListGrouped": {
        "type": "object",
        "properties": {
          "callbacksEnabled": {
            "type": "boolean",
            "description": "Whether webhook delivery is enabled for the organization."
          },
          "subscriptions": {
            "type": "object",
            "description": "Subscriptions grouped by entity slug; entities with no subscriptions are omitted.",
            "additionalProperties": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/WebhookSubscription"
              }
            }
          }
        }
      },
      "SubscriptionListForEntity": {
        "type": "object",
        "properties": {
          "entity": {
            "type": "string"
          },
          "callbacksEnabled": {
            "type": "boolean"
          },
          "subscriptions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookSubscription"
            }
          }
        }
      },
      "SubscriptionReplaceRequest": {
        "type": "object",
        "required": [
          "eventTypes",
          "callbackUrl"
        ],
        "properties": {
          "eventTypes": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string"
            },
            "description": "Desired set of event types for the entity (must belong to it; see the events catalog)."
          },
          "callbackUrl": {
            "type": "string",
            "format": "uri",
            "description": "Your HTTPS receiver. Client-supplied and forwarded to Pliant as-is."
          }
        }
      },
      "SubscriptionDeleteRequest": {
        "type": "object",
        "required": [
          "eventTypes"
        ],
        "properties": {
          "eventTypes": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string"
            },
            "description": "Event types to unsubscribe (must belong to the entity)."
          }
        }
      },
      "WebhookSigningKey": {
        "type": "object",
        "properties": {
          "alg": {
            "type": "string",
            "description": "Signature algorithm.",
            "example": "Ed25519"
          },
          "publicKey": {
            "type": "string",
            "description": "Raw Ed25519 public key (JWK `x`, base64url) for quick use; null if the key set has no Ed25519 key."
          },
          "jwks": {
            "type": "object",
            "description": "Full JWKS for Standard-Webhooks / JWK libraries.",
            "properties": {
              "keys": {
                "type": "array",
                "items": {
                  "type": "object"
                }
              }
            }
          }
        }
      },
      "TravelPolicy": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "example": 12
          },
          "name": {
            "type": "string",
            "example": "Default corporate policy"
          },
          "scope": {
            "$ref": "#/components/schemas/TravelPolicyScope"
          },
          "general": {
            "$ref": "#/components/schemas/TravelPolicyGeneral"
          },
          "flight": {
            "$ref": "#/components/schemas/TravelPolicyFlightRules"
          },
          "hotel": {
            "$ref": "#/components/schemas/TravelPolicyHotelRules"
          },
          "railway": {
            "$ref": "#/components/schemas/TravelPolicyRailwayRules"
          },
          "transfer": {
            "$ref": "#/components/schemas/TravelPolicyTransferRules"
          }
        }
      },
      "TravelPolicyInput": {
        "type": "object",
        "required": [
          "name"
        ],
        "description": "Same as TravelPolicy without id. Every rule section is optional.",
        "properties": {
          "name": {
            "type": "string"
          },
          "scope": {
            "$ref": "#/components/schemas/TravelPolicyScope"
          },
          "general": {
            "$ref": "#/components/schemas/TravelPolicyGeneral"
          },
          "flight": {
            "$ref": "#/components/schemas/TravelPolicyFlightRules"
          },
          "hotel": {
            "$ref": "#/components/schemas/TravelPolicyHotelRules"
          },
          "railway": {
            "$ref": "#/components/schemas/TravelPolicyRailwayRules"
          },
          "transfer": {
            "$ref": "#/components/schemas/TravelPolicyTransferRules"
          }
        }
      },
      "TravelPolicyScope": {
        "type": "object",
        "description": "Empty arrays = not scoped. userIds win over roleIds.",
        "properties": {
          "roleIds": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          },
          "userIds": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          }
        }
      },
      "TravelPolicyGeneral": {
        "type": "object",
        "properties": {
          "currency": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISO code; limits below are in this currency",
            "example": "EUR"
          },
          "violationMode": {
            "type": "string",
            "enum": [
              "show",
              "hide",
              "remove"
            ],
            "description": "show = badge + approval; hide = shown, booking disabled; remove = removed from results"
          },
          "purchaseApprovalRequired": {
            "type": "boolean",
            "description": "Require approval even for compliant offers"
          },
          "violationApproverIds": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          },
          "purchaseApproverIds": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          }
        }
      },
      "TravelPolicyFlightRules": {
        "type": "object",
        "properties": {
          "maxPriceOneWay": {
            "type": [
              "number",
              "null"
            ]
          },
          "maxAfterCheapestPrice": {
            "type": [
              "number",
              "null"
            ],
            "description": "Max delta above the cheapest fare"
          },
          "minDaysBeforeFlight": {
            "type": [
              "integer",
              "null"
            ]
          },
          "allowedCabins": {
            "type": "array",
            "description": "Subset of economy/premium_economy/business/first; [] = any",
            "items": {
              "type": "string",
              "enum": [
                "economy",
                "premium_economy",
                "business",
                "first"
              ]
            }
          },
          "onlyWithLuggage": {
            "type": "boolean"
          },
          "onlyRefundable": {
            "type": "boolean"
          },
          "onlyWorkingDays": {
            "type": "boolean",
            "description": "Departure must be Mon-Fri"
          },
          "cityOverrides": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TravelPolicyCityOverrideOneWay"
            }
          },
          "countryOverrides": {
            "type": "array",
            "description": "Limits by country of the arrival city of the first direction. A city limit wins over its country limit; both apply only while maxPriceOneWay is set. If the field is omitted on update, the current rows are kept; [] removes them all.",
            "items": {
              "$ref": "#/components/schemas/TravelPolicyCountryOverrideOneWay"
            }
          }
        }
      },
      "TravelPolicyHotelRules": {
        "type": "object",
        "properties": {
          "maxPriceNightly": {
            "type": [
              "number",
              "null"
            ],
            "description": "Per night"
          },
          "maxStars": {
            "type": [
              "integer",
              "null"
            ]
          },
          "minDaysBeforeCheckin": {
            "type": [
              "integer",
              "null"
            ]
          },
          "onlyRefundable": {
            "type": "boolean"
          },
          "blockedPropertyTypes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "cityOverrides": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TravelPolicyCityOverrideNightly"
            }
          },
          "countryOverrides": {
            "type": "array",
            "description": "Limits by the country the hotel is in. A city limit wins over its country limit; both apply only while maxPriceNightly is set. If the field is omitted on update, the current rows are kept; [] removes them all.",
            "items": {
              "$ref": "#/components/schemas/TravelPolicyCountryOverrideNightly"
            }
          }
        }
      },
      "TravelPolicyRailwayRules": {
        "type": "object",
        "properties": {
          "maxPriceOneWay": {
            "type": [
              "number",
              "null"
            ]
          },
          "minDaysBeforeTrip": {
            "type": [
              "integer",
              "null"
            ]
          },
          "wagonTypes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Allowed wagon-type codes; [] = any"
          },
          "cityOverrides": {
            "type": "array",
            "description": "cityId is a station id (a city or a single station) from GET /v1/data/transport-stations",
            "items": {
              "$ref": "#/components/schemas/TravelPolicyCityOverrideOneWay"
            }
          },
          "countryOverrides": {
            "type": "array",
            "description": "Limits by the country of the destination station. A station limit wins over its country limit; both apply only while maxPriceOneWay is set. If the field is omitted on update, the current rows are kept; [] removes them all.",
            "items": {
              "$ref": "#/components/schemas/TravelPolicyCountryOverrideOneWay"
            }
          }
        }
      },
      "TravelPolicyTransferRules": {
        "type": "object",
        "properties": {
          "maxPrice": {
            "type": [
              "number",
              "null"
            ]
          }
        }
      },
      "TravelPolicyCityOverrideOneWay": {
        "type": "object",
        "properties": {
          "cityId": {
            "type": "integer"
          },
          "cityName": {
            "type": "string"
          },
          "maxPriceOneWay": {
            "type": "number"
          }
        }
      },
      "TravelPolicyCityOverrideNightly": {
        "type": "object",
        "properties": {
          "cityId": {
            "type": "integer"
          },
          "cityName": {
            "type": "string"
          },
          "maxPriceNightly": {
            "type": "number"
          }
        }
      },
      "TravelPolicyCountryOverrideOneWay": {
        "type": "object",
        "required": [
          "countryId",
          "maxPriceOneWay"
        ],
        "properties": {
          "countryId": {
            "type": "integer",
            "description": "id from GET /v1/data/countries"
          },
          "countryName": {
            "type": "string",
            "readOnly": true,
            "description": "Response only: the name from the country directory, in the language of the request"
          },
          "maxPriceOneWay": {
            "type": "number",
            "exclusiveMinimum": 0,
            "description": "A row without a positive price is dropped"
          }
        }
      },
      "TravelPolicyCountryOverrideNightly": {
        "type": "object",
        "required": [
          "countryId",
          "maxPriceNightly"
        ],
        "properties": {
          "countryId": {
            "type": "integer",
            "description": "id from GET /v1/data/countries"
          },
          "countryName": {
            "type": "string",
            "readOnly": true,
            "description": "Response only: the name from the country directory, in the language of the request"
          },
          "maxPriceNightly": {
            "type": "number",
            "exclusiveMinimum": 0,
            "description": "A row without a positive price is dropped"
          }
        }
      },
      "TravelPolicyCheckRequest": {
        "type": "object",
        "required": [
          "entity",
          "payload"
        ],
        "properties": {
          "entity": {
            "type": "string",
            "enum": [
              "flight_offer",
              "hotel_offer",
              "train_offer"
            ]
          },
          "currency": {
            "type": "string",
            "description": "Currency of prices in payload; defaults to site currency",
            "example": "EUR"
          },
          "payload": {
            "description": "Shape depends on entity",
            "oneOf": [
              {
                "$ref": "#/components/schemas/TravelPolicyFlightOfferPayload"
              },
              {
                "$ref": "#/components/schemas/TravelPolicyHotelOfferPayload"
              },
              {
                "$ref": "#/components/schemas/TravelPolicyTrainOfferPayload"
              }
            ]
          }
        }
      },
      "TravelPolicyFlightOfferPayload": {
        "type": "object",
        "properties": {
          "cabin": {
            "description": "economy/premium_economy/business/first or Sirena code 1-4",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "integer"
              }
            ]
          },
          "price": {
            "type": "number"
          },
          "departureDate": {
            "type": "string",
            "format": "date"
          },
          "hasLuggage": {
            "type": "boolean"
          },
          "refundable": {
            "type": "boolean"
          },
          "cheapestFarePrice": {
            "type": "number"
          },
          "destinationCityId": {
            "type": "integer"
          },
          "destinationCityName": {
            "type": "string"
          }
        }
      },
      "TravelPolicyHotelOfferPayload": {
        "type": "object",
        "properties": {
          "starRating": {
            "type": "integer"
          },
          "price": {
            "type": "number",
            "description": "Nightly price"
          },
          "refundable": {
            "type": "boolean"
          },
          "propertyTypes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "checkinDate": {
            "type": "string",
            "format": "date"
          },
          "locationId": {
            "type": "integer"
          }
        }
      },
      "TravelPolicyTrainOfferPayload": {
        "type": "object",
        "properties": {
          "price": {
            "type": "number"
          },
          "departureDate": {
            "type": "string",
            "format": "date"
          },
          "wagonType": {
            "type": "string"
          }
        }
      },
      "TravelPolicyCheckResponse": {
        "type": "object",
        "properties": {
          "compliant": {
            "type": "boolean"
          },
          "violations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TravelPolicyViolation"
            }
          }
        }
      },
      "TravelPolicyViolation": {
        "type": "object",
        "properties": {
          "ruleId": {
            "type": "string",
            "example": "max_price_one_way"
          },
          "message": {
            "type": "string",
            "example": "Price exceeds the one-way limit"
          }
        }
      },
      "TravelPolicyErrorEnvelope": {
        "type": "object",
        "properties": {
          "errors": {
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        }
      },
      "IdentityDocument": {
        "type": "object",
        "properties": {
          "documentId": {
            "type": "integer",
            "example": 55
          },
          "kind": {
            "type": "string",
            "example": "PASSPORT",
            "description": "ClientDocType: PASSPORT | IDENTITY | PASSPORT_PSP | ..."
          },
          "number": {
            "type": "string",
            "nullable": true,
            "example": "MP*****67",
            "description": "Masked (first 2 + last 2 chars)"
          },
          "expiryDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          }
        }
      },
      "RecentTraveler": {
        "type": "object",
        "properties": {
          "travelerId": {
            "type": "integer",
            "nullable": true,
            "description": "Client id to pass at order creation; null if the profile was deleted"
          },
          "firstName": {
            "type": "string"
          },
          "lastName": {
            "type": "string"
          },
          "birthDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "nationality": {
            "type": "string",
            "nullable": true,
            "description": "ISO-3166 alpha-2"
          },
          "gender": {
            "type": "string",
            "nullable": true,
            "enum": [
              "M",
              "F"
            ]
          },
          "identityDocuments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IdentityDocument"
            }
          }
        }
      },
      "ClientUpsertRequest": {
        "type": "object",
        "required": [
          "firstName",
          "lastName",
          "gender",
          "dateOfBirth",
          "nationality"
        ],
        "properties": {
          "firstName": {
            "type": "string",
            "description": "Latin (firstNameEn)"
          },
          "lastName": {
            "type": "string",
            "description": "Latin (lastNameEn)"
          },
          "gender": {
            "type": "string",
            "enum": [
              "M",
              "F"
            ]
          },
          "dateOfBirth": {
            "type": "string",
            "format": "date"
          },
          "nationality": {
            "type": "string",
            "description": "ISO-3166 alpha-2"
          },
          "contacts": {
            "type": "object",
            "properties": {
              "email": {
                "type": "string",
                "format": "email"
              },
              "phone": {
                "type": "string"
              }
            }
          },
          "document": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "example": "PASSPORT"
              },
              "number": {
                "type": "string"
              },
              "expiryDate": {
                "type": "string",
                "format": "date"
              },
              "issuedAt": {
                "type": "string",
                "format": "date"
              }
            }
          }
        }
      },
      "ExpenseCreateRequest": {
        "type": "object",
        "required": [
          "amount",
          "currency",
          "category"
        ],
        "properties": {
          "amount": {
            "type": "number",
            "description": "> 0"
          },
          "currency": {
            "type": "string",
            "description": "ISO-4217"
          },
          "category": {
            "type": "string",
            "enum": [
              "meals",
              "transport",
              "lodging",
              "other"
            ]
          },
          "occurredAt": {
            "type": "string",
            "description": "date or datetime; defaults to now"
          },
          "merchant": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "receiptUrl": {
            "type": "string",
            "description": "link to an already-uploaded receipt"
          },
          "vatAmount": {
            "type": "number"
          },
          "lineItems": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "tripId": {
            "type": "integer",
            "description": "must be one of the caller's trips"
          }
        }
      },
      "ExpenseRow": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "merchant": {
            "type": "string"
          },
          "category": {
            "type": "string",
            "enum": [
              "meals",
              "transport",
              "lodging",
              "other"
            ]
          },
          "amount": {
            "type": "number"
          },
          "currency": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "approved",
              "rejected"
            ]
          },
          "tripId": {
            "type": "integer",
            "nullable": true
          },
          "vatAmount": {
            "type": "number",
            "nullable": true
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "receiptUrl": {
            "type": "string",
            "nullable": true
          },
          "lineItems": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "occurredAt": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          }
        }
      },
      "TravelPolicyFromJsonInput": {
        "type": "object",
        "required": [
          "name"
        ],
        "description": "LLM-produced draft-policy payload. Rule blocks use snake_case keys; inner fields match the standard rule schemas. Fetch GET /schema first. Created as a draft (no scope) until reviewed.",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 100
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "source": {
            "type": "string",
            "enum": [
              "ai_pdf_parse",
              "manual"
            ],
            "default": "manual",
            "description": "Origin of the payload (audit only)"
          },
          "flight_rules": {
            "$ref": "#/components/schemas/TravelPolicyFlightRules"
          },
          "hotel_rules": {
            "$ref": "#/components/schemas/TravelPolicyHotelRules"
          },
          "railway_rules": {
            "$ref": "#/components/schemas/TravelPolicyRailwayRules"
          },
          "car_rental_rules": {
            "$ref": "#/components/schemas/TravelPolicyTransferRules"
          },
          "ai_confidence": {
            "type": "object",
            "description": "Map field=>confidence 0..1; fields below 0.8 are returned in fields_low_confidence",
            "additionalProperties": {
              "type": "number",
              "minimum": 0,
              "maximum": 1
            }
          }
        }
      },
      "TravelPolicyDraft": {
        "allOf": [
          {
            "$ref": "#/components/schemas/TravelPolicy"
          },
          {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "draft"
                ],
                "description": "Always draft — created with no scope, enforces nothing until a human assigns scope"
              },
              "fields_low_confidence": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "ai_confidence keys below 0.8, for UI review highlighting"
              }
            }
          }
        ]
      },
      "OffPlatformBookingCreateRequest": {
        "type": "object",
        "required": [
          "type"
        ],
        "description": "snake_case keys; the camelCase form (`userId`, `totalPrice`, …) is accepted too. Only `type` is required.",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "flight",
              "hotel",
              "car",
              "train",
              "transfer",
              "experience"
            ],
            "example": "hotel"
          },
          "user_id": {
            "type": "integer",
            "description": "Traveller the booking is for. Omit to record it for the caller.",
            "example": 48211
          },
          "dates": {
            "type": "object",
            "description": "Travel dates. Any ISO date or date-time; stored as a date.",
            "properties": {
              "from": {
                "type": "string",
                "format": "date",
                "example": "2026-12-14"
              },
              "to": {
                "type": "string",
                "format": "date",
                "example": "2026-12-17"
              }
            }
          },
          "locations": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true,
              "properties": {
                "country": {
                  "type": "string",
                  "description": "Country name (any language) or ISO-2 code. Read from the first item."
                }
              }
            },
            "description": "Where the trip goes. The first item's `country` places the booking on the duty of care map.",
            "example": [
              {
                "country": "Germany",
                "city": "Berlin"
              }
            ]
          },
          "details": {
            "type": "object",
            "additionalProperties": true,
            "properties": {
              "title": {
                "type": "string",
                "description": "Supplier or booking name, shown as the card title"
              },
              "traveler": {
                "type": "string",
                "description": "Name as printed on the booking"
              },
              "note": {
                "type": "string"
              }
            },
            "description": "`title`, `traveler` and `note` are shown to the traveller; any other keys are stored as sent.",
            "example": {
              "title": "Hotel Adlon Kempinski",
              "traveler": "ANNA MUELLER",
              "roomType": "Deluxe King"
            }
          },
          "total_price": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0,
            "example": 1240.5
          },
          "currency": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 3,
            "description": "ISO 4217 code of the currency the booking was paid in. Lower case is accepted and stored in upper case.",
            "example": "EUR"
          },
          "confirmation_number": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 255,
            "description": "Supplier's confirmation or PNR. Use it to find the booking again.",
            "example": "ADL-58213"
          },
          "order_id": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Travel Code trip to show this booking in. `0` or `null` = a booking on its own."
          },
          "source": {
            "type": "string",
            "enum": [
              "email_forward",
              "robert_chat",
              "manual"
            ],
            "default": "manual",
            "description": "How the booking reached us. Integrations send `manual` (the default)."
          },
          "expense_report_id": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Open expense report of the same traveller this company-paid booking belongs to (Expenses module)."
          },
          "raw_input": {
            "type": [
              "string",
              "null"
            ],
            "description": "Original confirmation text, kept for audit. Never returned."
          }
        }
      },
      "OffPlatformBooking": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "example": 1934
          },
          "userId": {
            "type": "integer",
            "example": 48211
          },
          "orderId": {
            "type": [
              "integer",
              "null"
            ]
          },
          "expenseReportId": {
            "type": [
              "integer",
              "null"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "flight",
              "hotel",
              "car",
              "train",
              "transfer",
              "experience"
            ]
          },
          "dates": {
            "type": "object",
            "properties": {
              "from": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              },
              "to": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              }
            }
          },
          "locations": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "details": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "totalPrice": {
            "type": [
              "number",
              "null"
            ]
          },
          "currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "confirmationNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "source": {
            "type": "string",
            "enum": [
              "email_forward",
              "robert_chat",
              "manual"
            ]
          },
          "attachments": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "url": {
                  "type": "string",
                  "format": "uri",
                  "description": "Signed link, valid for a limited time. Fetch it again from the API rather than storing it."
                },
                "name": {
                  "type": "string"
                }
              }
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AutoApprovalCondition": {
        "type": "object",
        "required": [
          "field",
          "operator"
        ],
        "properties": {
          "field": {
            "type": "string",
            "description": "Booking field: type|price|outOfPolicy|outOfPolicyReason|cabin"
          },
          "operator": {
            "type": "string",
            "enum": [
              "<",
              ">",
              "<=",
              ">=",
              "=",
              "in",
              "not_in",
              "contains"
            ]
          },
          "value": {
            "description": "Scalar, or array for in/not_in"
          }
        }
      },
      "AutoApprovalRuleInput": {
        "type": "object",
        "required": [
          "name"
        ],
        "description": "Empty conditions = matches all the approver's requests.",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 128
          },
          "conditions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AutoApprovalCondition"
            }
          },
          "conditionsLogic": {
            "type": "string",
            "enum": [
              "AND",
              "OR"
            ],
            "default": "AND"
          },
          "active": {
            "type": "boolean",
            "default": true
          },
          "notifyMode": {
            "type": "string",
            "enum": [
              "realtime",
              "daily_digest",
              "none"
            ],
            "default": "realtime"
          },
          "maxPerDay": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "description": "Max auto-approvals/day; null = unlimited"
          }
        }
      },
      "AutoApprovalRule": {
        "allOf": [
          {
            "$ref": "#/components/schemas/AutoApprovalRuleInput"
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "integer"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time"
              }
            }
          }
        ]
      },
      "CompetitiveOfferFindRequest": {
        "type": "object",
        "required": [
          "cacheId",
          "competitor_price"
        ],
        "description": "cacheId = an existing flight search session; itemId optional (exact match, else cheapest).",
        "properties": {
          "competitor_name": {
            "type": "string",
            "enum": [
              "Navan",
              "TripActions",
              "other"
            ],
            "default": "other"
          },
          "cacheId": {
            "type": "string",
            "description": "Our search session id"
          },
          "itemId": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Specific offer id from the search; omit for cheapest"
          },
          "type": {
            "type": "string",
            "enum": [
              "flight",
              "hotel"
            ],
            "default": "flight"
          },
          "competitor_price": {
            "type": "number",
            "minimum": 0
          },
          "currency": {
            "type": "string",
            "maxLength": 3
          },
          "parsed_offer": {
            "type": "object",
            "description": "ТЗ nested alt for type/competitor_price/currency/cacheId/itemId",
            "additionalProperties": true
          },
          "user_context": {
            "type": "object",
            "properties": {
              "user_id": {
                "type": "integer"
              },
              "org_id": {
                "type": "integer"
              }
            }
          }
        }
      },
      "CompetitiveOfferResult": {
        "type": "object",
        "description": "netto and margin are intentionally NOT returned (audit only).",
        "properties": {
          "matched_offer": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "integer"
              },
              "totalPriceNet": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "durationTime": {
                "type": [
                  "integer",
                  "null"
                ]
              }
            }
          },
          "our_retail_price": {
            "type": [
              "number",
              "null"
            ]
          },
          "special_price": {
            "type": [
              "number",
              "null"
            ],
            "description": "Between netto and retail"
          },
          "matched_quality": {
            "type": "string",
            "enum": [
              "exact",
              "similar",
              "none"
            ]
          },
          "cannot_beat": {
            "type": "boolean"
          },
          "one_time_booking_link": {
            "type": [
              "string",
              "null"
            ],
            "description": "Phase B — currently null"
          }
        }
      },
      "VirtualCardStatement": {
        "type": "object",
        "properties": {
          "statementId": {
            "type": "string"
          },
          "cardAccountId": {
            "type": [
              "string",
              "null"
            ]
          },
          "period": {
            "type": "object",
            "properties": {
              "start": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              },
              "end": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              }
            }
          },
          "openingBalance": {
            "$ref": "#/components/schemas/MonetaryAmount"
          },
          "closingBalance": {
            "$ref": "#/components/schemas/MonetaryAmount"
          },
          "totalTransactionAmount": {
            "$ref": "#/components/schemas/MonetaryAmount"
          },
          "totalPaymentAmount": {
            "$ref": "#/components/schemas/MonetaryAmount"
          },
          "isClosed": {
            "type": "boolean"
          },
          "status": {
            "type": "string",
            "enum": [
              "CLOSED",
              "ONGOING"
            ]
          },
          "statementCreatedAt": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "VirtualCardStatementList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VirtualCardStatement"
            }
          },
          "total": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          },
          "limit": {
            "type": "integer"
          }
        }
      },
      "VirtualCardStatementDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/VirtualCardStatement"
          },
          {
            "type": "object",
            "properties": {
              "bills": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/VirtualCardBillPayment"
                },
                "description": "Present only when scope includes 'bills'."
              },
              "transactions": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/VirtualCardTransaction"
                },
                "description": "Present only when scope includes 'transactions'."
              }
            }
          }
        ]
      },
      "VirtualCardBillPayment": {
        "type": "object",
        "description": "A statement bill payment (top-up, wire, bill settlement, payout).",
        "properties": {
          "paymentId": {
            "type": "string"
          },
          "publicPaymentId": {
            "type": [
              "string",
              "null"
            ]
          },
          "cardAccountId": {
            "type": [
              "string",
              "null"
            ]
          },
          "billId": {
            "type": [
              "string",
              "null"
            ]
          },
          "type": {
            "type": "string",
            "example": "TOPUP"
          },
          "method": {
            "type": [
              "string",
              "null"
            ],
            "example": "WIRE_TRANSFER"
          },
          "status": {
            "type": "string",
            "example": "PAID"
          },
          "amount": {
            "$ref": "#/components/schemas/MonetaryAmount"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "plannedPaymentDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "actualPaymentDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          }
        }
      },
      "VirtualCardStatementSyncResult": {
        "type": "object",
        "properties": {
          "statementsFetched": {
            "type": "integer"
          },
          "statementsInserted": {
            "type": "integer"
          },
          "statementsUpdated": {
            "type": "integer"
          },
          "paymentsInserted": {
            "type": "integer"
          },
          "paymentsUpdated": {
            "type": "integer"
          },
          "paymentsSkipped": {
            "type": "integer"
          },
          "errors": {
            "type": "integer"
          },
          "pages": {
            "type": "integer"
          }
        }
      },
      "Category": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "title": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "status": {
            "type": "boolean",
            "description": "Enabled toggle."
          },
          "giCode": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "CategoryList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Category"
            }
          },
          "total": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          },
          "limit": {
            "type": "integer"
          }
        }
      },
      "ExternalBankAccount": {
        "type": "object",
        "properties": {
          "bankAccountId": {
            "type": "string",
            "description": "External bank account UUID — pass as `bankAccountId` when creating a payout.",
            "example": "b1a2c3d4-5e6f-7089-a0b1-c2d3e4f50617"
          },
          "bankName": {
            "type": "string",
            "example": "Example Bank AG"
          },
          "bic": {
            "type": "string",
            "example": "EXAMPLEXXX"
          },
          "accountNumber": {
            "type": "string",
            "description": "Format depends on accountNumberType.",
            "example": "DE89370400440532013000"
          },
          "accountNumberType": {
            "type": "string",
            "enum": [
              "IBAN",
              "CLABE",
              "DOMESTIC"
            ]
          },
          "currency": {
            "type": [
              "string",
              "null"
            ],
            "example": "EUR"
          },
          "transfersAllowed": {
            "type": "string",
            "enum": [
              "REVIEW",
              "AUTHORIZED",
              "BLOCKED"
            ],
            "description": "REVIEW = manual approval required, AUTHORIZED = usable, BLOCKED = cannot be used."
          }
        }
      },
      "PayoutRequest": {
        "type": "object",
        "required": [
          "bankAccountId",
          "amount"
        ],
        "properties": {
          "bankAccountId": {
            "type": "string",
            "description": "Destination external bank account id.",
            "example": "b1a2c3d4-5e6f-7089-a0b1-c2d3e4f50617"
          },
          "amount": {
            "$ref": "#/components/schemas/MonetaryAmount"
          }
        }
      },
      "Payout": {
        "type": "object",
        "properties": {
          "paymentId": {
            "type": "string"
          },
          "publicPaymentId": {
            "type": [
              "string",
              "null"
            ]
          },
          "cardAccountId": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "example": "PAYOUT"
          },
          "method": {
            "type": "string",
            "example": "WIRE_TRANSFER"
          },
          "status": {
            "type": "string",
            "example": "PENDING"
          },
          "amount": {
            "$ref": "#/components/schemas/MonetaryAmount"
          }
        }
      },
      "CommissionProgram": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "description": "Program / grid code as printed (AJBS6, DANAH2); the tour code when there is no other code"
          },
          "name": {
            "type": "string"
          },
          "airlines": {
            "type": "object",
            "properties": {
              "validating": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Validating carriers: ARC numeric (001) or IATA"
              },
              "marketing": {
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[A-Z0-9]{2}$"
                }
              },
              "operating": {
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[A-Z0-9]{2}$"
                }
              }
            },
            "required": [
              "validating",
              "marketing",
              "operating"
            ],
            "additionalProperties": false
          },
          "ticketing": {
            "type": "object",
            "properties": {
              "from": {
                "type": "string",
                "pattern": "^(\\d{4}-\\d{2}-\\d{2})?$",
                "description": "YYYY-MM-DD, empty string when not stated"
              },
              "to": {
                "type": "string",
                "pattern": "^(\\d{4}-\\d{2}-\\d{2})?$",
                "description": "YYYY-MM-DD, empty string when not stated"
              }
            },
            "required": [
              "from",
              "to"
            ],
            "additionalProperties": false
          },
          "travel": {
            "type": "object",
            "properties": {
              "from": {
                "type": "string",
                "pattern": "^(\\d{4}-\\d{2}-\\d{2})?$",
                "description": "YYYY-MM-DD, empty string when not stated"
              },
              "to": {
                "type": "string",
                "pattern": "^(\\d{4}-\\d{2}-\\d{2})?$",
                "description": "YYYY-MM-DD, empty string when not stated"
              },
              "perFareRules": {
                "type": "boolean"
              }
            },
            "required": [
              "from",
              "to",
              "perFareRules"
            ],
            "additionalProperties": false
          },
          "pointOfSale": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[A-Z]{2}$"
            }
          },
          "tourCode": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "description": "Empty when the program needs no tour code"
              },
              "placement": {
                "type": "string",
                "enum": [
                  "",
                  "tour_code_box",
                  "osi",
                  "both"
                ]
              }
            },
            "required": [
              "code",
              "placement"
            ],
            "additionalProperties": false
          },
          "markets": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "countries": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "pattern": "^[A-Z]{2}$"
                  }
                },
                "cities": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "airports": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  }
                },
                "excludeCountries": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "pattern": "^[A-Z]{2}$"
                  }
                },
                "routes": {
                  "type": "array",
                  "items": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    "minItems": 2,
                    "maxItems": 2
                  },
                  "description": "Specific O&D pairs that define the market, when the document lists them"
                }
              },
              "required": [
                "name",
                "countries",
                "cities",
                "airports",
                "excludeCountries",
                "routes"
              ],
              "additionalProperties": false
            }
          },
          "rates": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "origin": {
                  "type": "object",
                  "properties": {
                    "market": {
                      "type": "string",
                      "description": "Name of a market defined in this program's `markets`, empty string when the side is not a market"
                    },
                    "airports": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[A-Z]{3}$"
                      },
                      "description": "IATA airport codes; empty when not an airport list"
                    },
                    "cities": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "IATA city codes (NYC, LON); empty when not a city list"
                    },
                    "countries": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[A-Z]{2}$"
                      },
                      "description": "ISO-3166 alpha-2; empty when not a country list"
                    },
                    "excludeAirports": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[A-Z]{3}$"
                      }
                    },
                    "excludeCountries": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[A-Z]{2}$"
                      }
                    }
                  },
                  "required": [
                    "market",
                    "airports",
                    "cities",
                    "countries",
                    "excludeAirports",
                    "excludeCountries"
                  ],
                  "additionalProperties": false,
                  "description": "Exactly one of market / airports / cities / countries is filled. All empty = anywhere."
                },
                "destination": {
                  "type": "object",
                  "properties": {
                    "market": {
                      "type": "string",
                      "description": "Name of a market defined in this program's `markets`, empty string when the side is not a market"
                    },
                    "airports": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[A-Z]{3}$"
                      },
                      "description": "IATA airport codes; empty when not an airport list"
                    },
                    "cities": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "IATA city codes (NYC, LON); empty when not a city list"
                    },
                    "countries": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[A-Z]{2}$"
                      },
                      "description": "ISO-3166 alpha-2; empty when not a country list"
                    },
                    "excludeAirports": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[A-Z]{3}$"
                      }
                    },
                    "excludeCountries": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[A-Z]{2}$"
                      }
                    }
                  },
                  "required": [
                    "market",
                    "airports",
                    "cities",
                    "countries",
                    "excludeAirports",
                    "excludeCountries"
                  ],
                  "additionalProperties": false,
                  "description": "Exactly one of market / airports / cities / countries is filled. All empty = anywhere."
                },
                "isDomestic": {
                  "type": "string",
                  "enum": [
                    "",
                    "domestic",
                    "international"
                  ],
                  "description": "Empty = either"
                },
                "cabin": {
                  "type": "string",
                  "enum": [
                    "economy",
                    "premium_economy",
                    "business",
                    "first"
                  ]
                },
                "bookingClasses": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "pattern": "^[A-Z]$"
                  },
                  "description": "Booking classes (RBD) earning this rate. Columns with the same rate are merged into one row."
                },
                "value": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "percentage",
                        "amount"
                      ]
                    },
                    "amount": {
                      "type": "number"
                    },
                    "currency": {
                      "type": "string",
                      "pattern": "^([A-Z]{3})?$",
                      "description": "ISO 4217 for type=amount, empty for percentage"
                    }
                  },
                  "required": [
                    "type",
                    "amount",
                    "currency"
                  ],
                  "additionalProperties": false
                },
                "season": {
                  "type": "string",
                  "description": "Seasonality rule in words when the rate depends on it (e.g. 'fare basis 2nd char L = low season'), else empty"
                },
                "fareBasisPattern": {
                  "type": "string",
                  "description": "Fare-basis condition in words (e.g. '3rd char R = I-Regular'), else empty"
                },
                "notes": {
                  "type": "string",
                  "description": "Anything about this row that the fields above cannot express, else empty"
                }
              },
              "required": [
                "origin",
                "destination",
                "isDomestic",
                "cabin",
                "bookingClasses",
                "value",
                "season",
                "fareBasisPattern",
                "notes"
              ],
              "additionalProperties": false
            }
          },
          "conditions": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Short English sentences: eligibility, exclusions, combinability (max 15)"
          }
        },
        "required": [
          "code",
          "name",
          "airlines",
          "ticketing",
          "travel",
          "pointOfSale",
          "tourCode",
          "markets",
          "rates",
          "conditions"
        ],
        "additionalProperties": true
      },
      "CommissionSource": {
        "type": "object",
        "properties": {
          "consolidator": {
            "type": "string"
          },
          "document": {
            "type": "string"
          },
          "documentVersion": {
            "type": "string",
            "description": "Version as printed or in the file name (V9), else empty"
          },
          "receivedAt": {
            "type": "string",
            "pattern": "^(\\d{4}-\\d{2}-\\d{2})?$",
            "description": "YYYY-MM-DD, empty string when not stated"
          }
        },
        "required": [
          "consolidator",
          "document",
          "documentVersion",
          "receivedAt"
        ],
        "additionalProperties": false,
        "description": "The consolidator document a program was read from."
      },
      "HotelGuest": {
        "type": "object",
        "required": [
          "type",
          "firstName",
          "lastName",
          "gender",
          "dateOfBirth",
          "nationality"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "adult",
              "child",
              "infant"
            ],
            "description": "Required — a guest without it is rejected (`rooms.0.guests.0.type must be a string`)."
          },
          "firstName": {
            "type": "string"
          },
          "lastName": {
            "type": "string"
          },
          "gender": {
            "type": "string",
            "enum": [
              "M",
              "F"
            ]
          },
          "dateOfBirth": {
            "type": "string",
            "format": "date",
            "description": "`YYYY-MM-DD` only."
          },
          "nationality": {
            "type": "string",
            "example": "US",
            "description": "ISO-3166 alpha-2, required."
          },
          "contacts": {
            "type": "object",
            "properties": {
              "email": {
                "type": "string",
                "format": "email"
              },
              "phone": {
                "type": "string",
                "example": "+1 305 555 0100",
                "description": "International format with the country code (`+<code> <number>`). Amadeus rejects a booking without a calling code. For flights the first passenger's phone is the booking contact; without it the caller's account phone is used."
              }
            }
          },
          "document": {
            "type": "object",
            "required": [
              "number"
            ],
            "description": "Travel document. Required for flights; for hotels optional.",
            "properties": {
              "type": {
                "type": "string",
                "default": "PASSPORT",
                "example": "PASSPORT"
              },
              "number": {
                "type": "string",
                "example": "PD0000000",
                "description": "Full number. Masked numbers (`PD*****37`) from `/v1/user/recent-travelers` are rejected — read the full one from `GET /v1/clients/{id}/documents`."
              },
              "expiryDate": {
                "type": "string",
                "format": "date",
                "description": "`YYYY-MM-DD` (flights also accept `DD.MM.YYYY`). The field is `expiryDate`, not `expiry`."
              },
              "issuedAt": {
                "type": "string",
                "format": "date",
                "description": "`YYYY-MM-DD`, optional."
              },
              "nationality": {
                "type": "string",
                "example": "US",
                "description": "Issuing country, ISO-3166 alpha-2. Defaults to the passenger's `nationality`."
              }
            }
          }
        }
      },
      "OffPlatformBookingUpdateRequest": {
        "type": "object",
        "description": "Send only the fields that change; a field you leave out keeps its value. Sending `null` or an empty value clears it. The traveller cannot be changed.",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "flight",
              "hotel",
              "car",
              "train",
              "transfer",
              "experience"
            ],
            "example": "hotel"
          },
          "dates": {
            "type": "object",
            "description": "Travel dates. Any ISO date or date-time; stored as a date.",
            "properties": {
              "from": {
                "type": "string",
                "format": "date",
                "example": "2026-12-14"
              },
              "to": {
                "type": "string",
                "format": "date",
                "example": "2026-12-17"
              }
            }
          },
          "locations": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true,
              "properties": {
                "country": {
                  "type": "string",
                  "description": "Country name (any language) or ISO-2 code. Read from the first item."
                }
              }
            },
            "description": "Where the trip goes. The first item's `country` places the booking on the duty of care map.",
            "example": [
              {
                "country": "Germany",
                "city": "Berlin"
              }
            ]
          },
          "details": {
            "type": "object",
            "additionalProperties": true,
            "properties": {
              "title": {
                "type": "string",
                "description": "Supplier or booking name, shown as the card title"
              },
              "traveler": {
                "type": "string",
                "description": "Name as printed on the booking"
              },
              "note": {
                "type": "string"
              }
            },
            "description": "`title`, `traveler` and `note` are shown to the traveller; any other keys are stored as sent.",
            "example": {
              "title": "Hotel Adlon Kempinski",
              "traveler": "ANNA MUELLER",
              "roomType": "Deluxe King"
            }
          },
          "total_price": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0,
            "example": 1240.5
          },
          "currency": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 3,
            "description": "ISO 4217 code of the currency the booking was paid in. Lower case is accepted and stored in upper case.",
            "example": "EUR"
          },
          "confirmation_number": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 255,
            "description": "Supplier's confirmation or PNR. Use it to find the booking again.",
            "example": "ADL-58213"
          },
          "order_id": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Travel Code trip to show this booking in. `0` or `null` = a booking on its own."
          },
          "source": {
            "type": "string",
            "enum": [
              "email_forward",
              "robert_chat",
              "manual"
            ],
            "default": "manual",
            "description": "How the booking reached us. Integrations send `manual` (the default)."
          }
        }
      },
      "OffPlatformBookingList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OffPlatformBooking"
            }
          },
          "total": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          },
          "limit": {
            "type": "integer"
          }
        }
      },
      "CompanyEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "offsite",
              "sko",
              "conference",
              "retreat",
              "incentive",
              "other"
            ]
          },
          "typeLabel": {
            "type": "string"
          },
          "location": {
            "$ref": "#/components/schemas/CompanyEventLocation"
          },
          "startDate": {
            "type": "string",
            "format": "date"
          },
          "endDate": {
            "type": "string",
            "format": "date"
          },
          "daysUntil": {
            "type": "integer",
            "description": "Whole days to the start; 0 once started."
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "open",
              "in_progress",
              "completed",
              "closed",
              "cancelled"
            ]
          },
          "statusLabel": {
            "type": "string"
          },
          "targetParticipants": {
            "type": [
              "integer",
              "null"
            ]
          },
          "participants": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "total": {
                "type": "integer"
              },
              "added": {
                "type": "integer",
                "description": "Neither sent a letter nor answered."
              },
              "invited": {
                "type": "integer",
                "description": "Sent a letter (invitedAt)."
              },
              "waiting": {
                "type": "integer"
              },
              "accepted": {
                "type": "integer",
                "description": "Answered yes, with or without a letter."
              },
              "declined": {
                "type": "integer"
              },
              "answered": {
                "type": "integer",
                "description": "Answers of those sent a letter."
              },
              "acceptedOfInvited": {
                "type": "integer"
              }
            },
            "description": "Participants and co-organizers, never the owner (CompanyEventHeadcount); the same numbers on the list strip, the participants tab and the budget. Null for a caller who does not run the event."
          },
          "budget": {
            "oneOf": [
              {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/CompanyEventMoney"
                  }
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "null without budget_view, or when no budget is set."
          },
          "myRole": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "owner",
              "co_organizer",
              "participant"
            ],
            "description": "null when the caller is not a member."
          },
          "myMemberId": {
            "type": [
              "integer",
              "null"
            ],
            "description": "The caller's member row (the members list `id`); null when not a member."
          },
          "myServices": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string",
              "enum": [
                "flight",
                "hotel",
                "railway",
                "transfer",
                "car",
                "bus",
                "airbnb"
              ]
            },
            "description": "What the caller may book; null when not a member."
          },
          "travelWindow": {
            "type": "object",
            "properties": {
              "from": {
                "type": "string",
                "format": "date"
              },
              "to": {
                "type": "string",
                "format": "date"
              }
            },
            "description": "settings.window span, else the event dates."
          },
          "travelWindowSet": {
            "type": "boolean",
            "description": "Window dates are set. False means no window is checked and travelWindow holds the event dates."
          },
          "settingsSaved": {
            "type": "boolean",
            "description": "Booking settings were saved at least once, with or without window dates."
          },
          "nextStatuses": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Statuses the caller may move the event to today; in_progress opens on the first travel-window day, completed on the last event day. Empty without edit."
          },
          "permissions": {
            "$ref": "#/components/schemas/CompanyEventPermissions"
          }
        },
        "required": [
          "id",
          "name",
          "type",
          "location",
          "startDate",
          "endDate",
          "status",
          "participants",
          "permissions"
        ]
      },
      "CompanyEventAddMembersInput": {
        "type": "object",
        "properties": {
          "userIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "minItems": 1
          }
        },
        "required": [
          "userIds"
        ]
      },
      "CompanyEventBlock": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "eventId": {
            "type": "integer"
          },
          "status": {
            "type": "string",
            "enum": [
              "requested",
              "offers_ready",
              "accepted",
              "booked",
              "cancelled"
            ]
          },
          "statusLabel": {
            "type": "string"
          },
          "checkIn": {
            "type": "string",
            "format": "date"
          },
          "checkOut": {
            "type": "string",
            "format": "date"
          },
          "nights": {
            "type": "integer"
          },
          "rooms": {
            "type": "integer"
          },
          "roomType": {
            "type": [
              "string",
              "null"
            ]
          },
          "budgetPerNight": {
            "type": [
              "number",
              "null"
            ],
            "description": "Null without budget_view."
          },
          "currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "notes": {
            "type": [
              "string",
              "null"
            ],
            "description": "Organizers and agents only."
          },
          "deadline": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "Offers needed by."
          },
          "shortlist": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CompanyEventBlockHotel"
            },
            "description": "Organizers and agents only."
          },
          "acceptedOfferId": {
            "type": [
              "integer",
              "null"
            ]
          },
          "order": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "integer"
              },
              "code": {
                "type": "string"
              }
            },
            "description": "The linked order; organizers and agents only."
          },
          "workItemId": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Agents only."
          },
          "requestedBy": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "integer"
          },
          "offers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CompanyEventBlockOffer"
            }
          },
          "roomList": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CompanyEventBlockRoom"
            },
            "description": "Once an offer is accepted; organizers and agents only."
          },
          "permissions": {
            "$ref": "#/components/schemas/CompanyEventBlockPermissions"
          },
          "acceptable": {
            "type": "boolean",
            "description": "Offers ready and the event not frozen. Accepting takes event_block.organize too."
          },
          "cancellable": {
            "type": "boolean",
            "description": "Cancelling takes event_block.cancel too."
          },
          "takesOffers": {
            "type": "boolean",
            "description": "Adding an offer takes event_block.agent_work too."
          },
          "awaitsOrder": {
            "type": "boolean",
            "description": "Accepted; linking the order takes event_block.agent_work too."
          },
          "roomsAssignable": {
            "type": "boolean",
            "description": "Assigning rooms takes event_block.organize too."
          }
        }
      },
      "CompanyEventBlockDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/CompanyEventBlock"
          },
          {
            "type": "object",
            "properties": {
              "currencies": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "event": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "integer"
                  },
                  "name": {
                    "type": "string"
                  },
                  "location": {
                    "type": "string"
                  },
                  "currency": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "permissions": {
                    "$ref": "#/components/schemas/CompanyEventPermissions"
                  }
                }
              }
            }
          }
        ]
      },
      "CompanyEventBlockHotel": {
        "type": "object",
        "description": "A hotel of our catalog.",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Giata id."
          },
          "name": {
            "type": "string"
          },
          "address": {
            "type": "string"
          }
        }
      },
      "CompanyEventBlockOffer": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "hotel": {
            "$ref": "#/components/schemas/CompanyEventBlockHotel"
          },
          "pricePerNight": {
            "type": [
              "number",
              "null"
            ],
            "description": "Null without budget_view (agents always see it)."
          },
          "total": {
            "type": [
              "number",
              "null"
            ],
            "description": "pricePerNight × rooms × nights, computed by the server. Null without budget_view."
          },
          "currency": {
            "type": "string"
          },
          "rooms": {
            "type": "integer"
          },
          "nights": {
            "type": "integer"
          },
          "cancellation": {
            "type": [
              "string",
              "null"
            ]
          },
          "attrition": {
            "type": [
              "string",
              "null"
            ]
          },
          "validUntil": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "expired": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "integer",
            "description": "Unix seconds."
          }
        }
      },
      "CompanyEventBlockOfferInput": {
        "type": "object",
        "required": [
          "hotelId",
          "pricePerNight"
        ],
        "properties": {
          "hotelId": {
            "type": "integer",
            "description": "Giata id of our catalog."
          },
          "pricePerNight": {
            "type": "string",
            "pattern": "^\\d+(\\.\\d{1,2})?$",
            "description": "At most two decimals, not above 1000000."
          },
          "currency": {
            "type": "string",
            "description": "Defaults to the block currency, then the event budget currency."
          },
          "rooms": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000,
            "description": "Defaults to the block's rooms."
          },
          "nights": {
            "type": "integer",
            "minimum": 1,
            "maximum": 60,
            "description": "Defaults to the block's nights."
          },
          "cancellation": {
            "type": "string"
          },
          "attrition": {
            "type": "string"
          },
          "validUntil": {
            "type": "string",
            "format": "date"
          }
        },
        "description": "A total in the body is ignored: the server computes it."
      },
      "CompanyEventBlockPermissions": {
        "type": "array",
        "items": {
          "type": "string",
          "enum": [
            "event_block.organize",
            "event_block.agent_work",
            "event_block.cancel"
          ]
        },
        "description": "The caller's side of the event's room blocks: organize (request, shortlist, accept, rooming list), agent_work (offers, the order), cancel (either)."
      },
      "CompanyEventBlockRequestInput": {
        "type": "object",
        "required": [
          "checkIn",
          "checkOut",
          "rooms"
        ],
        "properties": {
          "checkIn": {
            "type": "string",
            "format": "date"
          },
          "checkOut": {
            "type": "string",
            "format": "date",
            "description": "At least one night after checkIn."
          },
          "rooms": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000
          },
          "roomType": {
            "type": "string",
            "maxLength": 64
          },
          "budgetPerNight": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000
          },
          "currency": {
            "type": "string",
            "description": "A travel policy currency; defaults to the event budget currency when a budget is given."
          },
          "notes": {
            "type": "string",
            "maxLength": 5000
          },
          "deadline": {
            "type": "string",
            "format": "date"
          },
          "shortlistHotelIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "description": "Giata ids of our catalog; when omitted, the draft shortlist is used."
          }
        }
      },
      "CompanyEventBlockRoom": {
        "type": "object",
        "properties": {
          "roomNo": {
            "type": "integer"
          },
          "member": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "integer",
                "description": "Member row id."
              },
              "name": {
                "type": "string"
              }
            }
          },
          "sharedWith": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "integer"
              },
              "name": {
                "type": "string"
              }
            }
          }
        }
      },
      "CompanyEventBlocks": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CompanyEventBlock"
            }
          },
          "shortlist": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CompanyEventBlockHotel"
            },
            "description": "Draft shortlist kept while no request is open; organizers only."
          },
          "myRoom": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "blockId": {
                "type": "integer"
              },
              "hotel": {
                "$ref": "#/components/schemas/CompanyEventBlockHotel"
              },
              "checkIn": {
                "type": "string",
                "format": "date"
              },
              "checkOut": {
                "type": "string",
                "format": "date"
              },
              "roomNo": {
                "type": "integer"
              },
              "roommate": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "description": "The caller's own place in a rooming list."
          },
          "currencies": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Travel policy currencies."
          },
          "permissions": {
            "$ref": "#/components/schemas/CompanyEventBlockPermissions"
          },
          "requestsOpen": {
            "type": "boolean",
            "description": "Neither a draft nor frozen. A request takes event_block.organize too."
          }
        }
      },
      "CompanyEventBooking": {
        "type": "object",
        "properties": {
          "orderId": {
            "type": "integer"
          },
          "publicCode": {
            "type": "string"
          },
          "traveller": {
            "type": "object",
            "properties": {
              "userId": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "name": {
                "type": "string"
              }
            }
          },
          "service": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "flight",
                "hotel",
                "railway",
                "transfer",
                "car",
                "bus"
              ]
            }
          },
          "dates": {
            "type": "object",
            "properties": {
              "from": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              },
              "to": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              }
            }
          },
          "status": {
            "type": "string"
          },
          "amount": {
            "type": [
              "number",
              "null"
            ],
            "description": "Client amount; null without budget_view."
          },
          "currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "outOfWindow": {
            "type": "boolean"
          }
        }
      },
      "CompanyEventBookings": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CompanyEventBooking"
            }
          },
          "total": {
            "type": "integer",
            "description": "All bookings of the event, ignoring the outOfWindow filter."
          },
          "outOfWindow": {
            "type": "integer"
          },
          "amounts": {
            "type": "boolean",
            "description": "true when amounts are included (budget_view)."
          }
        },
        "required": [
          "items",
          "total",
          "outOfWindow",
          "amounts"
        ]
      },
      "CompanyEventBudget": {
        "type": "object",
        "properties": {
          "groupBy": {
            "type": "string",
            "enum": [
              "category",
              "participant",
              "costCenter",
              "department"
            ]
          },
          "currency": {
            "type": "string"
          },
          "approximate": {
            "type": "boolean",
            "description": "Some amount had no exchange rate to `currency` and was counted as it is."
          },
          "missingRates": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The currencies without a rate."
          },
          "participants": {
            "type": "integer"
          },
          "rows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CompanyEventBudgetRow"
            }
          },
          "totals": {
            "type": "object",
            "properties": {
              "estimated": {
                "type": "number"
              },
              "booked": {
                "type": "number"
              },
              "paid": {
                "type": "number"
              },
              "spent": {
                "type": "number"
              },
              "committed": {
                "type": "number",
                "description": "booked + spent"
              },
              "budget": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "variance": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "budget − (booked + spent); null without a budget."
              }
            }
          },
          "transactions": {
            "type": "array",
            "description": "The 10 latest booked orders and spent expenses, amounts in `currency`.",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "order",
                    "expense"
                  ]
                },
                "date": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date"
                },
                "title": {
                  "type": "string"
                },
                "services": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "category": {
                  "type": "string"
                },
                "categoryLabel": {
                  "type": "string"
                },
                "traveller": {
                  "type": "string"
                },
                "amount": {
                  "type": "number"
                },
                "currency": {
                  "type": "string"
                }
              }
            }
          },
          "attribution": {
            "type": "object",
            "properties": {
              "costCenter": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "code": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              },
              "legalEntity": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "departments": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "permissions": {
            "$ref": "#/components/schemas/CompanyEventPermissions"
          },
          "budgetFrozen": {
            "type": "boolean",
            "description": "Closed or cancelled. Adjusting the budget takes event.edit and a budget not frozen."
          }
        }
      },
      "CompanyEventBudgetRow": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "description": "A category (flights, hotels, rail, ground, other), expense:<CODE>, an entity id, or none."
          },
          "label": {
            "type": "string",
            "description": "Empty for categories and none."
          },
          "estimated": {
            "type": [
              "number",
              "null"
            ]
          },
          "booked": {
            "type": "number"
          },
          "paid": {
            "type": "number"
          },
          "spent": {
            "type": "number"
          },
          "variance": {
            "type": [
              "number",
              "null"
            ],
            "description": "estimated − (booked + spent); null without an estimate."
          }
        }
      },
      "CompanyEventCandidates": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "userId": {
                  "type": "integer"
                },
                "name": {
                  "type": "string"
                },
                "email": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "CompanyEventCard": {
        "type": "object",
        "description": "An event card as the event page shows it. Never the number, expiry or CVV.",
        "required": [
          "id",
          "userId",
          "holder",
          "mine",
          "cardId",
          "status",
          "statusLabel",
          "closing",
          "open",
          "limit",
          "spent",
          "createdAt"
        ],
        "properties": {
          "id": {
            "type": "integer"
          },
          "memberId": {
            "type": [
              "integer",
              "null"
            ]
          },
          "userId": {
            "type": "integer"
          },
          "holder": {
            "type": "string",
            "description": "The holder's display name."
          },
          "mine": {
            "type": "boolean",
            "description": "True when the caller is the holder."
          },
          "cardId": {
            "type": "string",
            "description": "The issuer's card id."
          },
          "last4": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "description": "Issuer status, e.g. ACTIVE, PENDING, LOCKED, TERMINATED."
          },
          "statusLabel": {
            "type": "string",
            "description": "The status in the caller's language."
          },
          "closing": {
            "type": "boolean",
            "description": "The card is about to be closed (access lost, cards switched off)."
          },
          "open": {
            "type": "boolean",
            "description": "The card can be used now."
          },
          "validFrom": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "validTo": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "timezone": {
            "type": [
              "string",
              "null"
            ],
            "description": "IANA zone the validity days are counted in."
          },
          "timezoneDerived": {
            "type": "boolean",
            "description": "True when the zone is the event city's own."
          },
          "place": {
            "type": [
              "string",
              "null"
            ],
            "description": "The place the zone belongs to, in the caller's language."
          },
          "limit": {
            "$ref": "#/components/schemas/CompanyEventMoney"
          },
          "spent": {
            "$ref": "#/components/schemas/CompanyEventMoney"
          },
          "createdAt": {
            "type": "integer",
            "description": "Unix time."
          },
          "closedAt": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Unix time."
          }
        }
      },
      "CompanyEventCardExpense": {
        "type": "object",
        "required": [
          "id",
          "merchant",
          "amount",
          "currency",
          "status",
          "statusLabel",
          "hasReceipt"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "description": "The expense id, for `/v1/expenses/{id}`."
          },
          "date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "merchant": {
            "type": "string"
          },
          "amount": {
            "type": "number"
          },
          "currency": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "statusLabel": {
            "type": "string"
          },
          "hasReceipt": {
            "type": "boolean"
          },
          "expenseUrl": {
            "type": [
              "string",
              "null"
            ],
            "description": "Link to the expense in the app, when the caller has the expenses tools."
          }
        }
      },
      "CompanyEventCardIssueInput": {
        "type": "object",
        "properties": {
          "limit": {
            "type": "number",
            "description": "Card limit. Default: the event's per-person card limit."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 code of the limit. Default: the event's card currency."
          },
          "categories": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Merchant categories the card may be used for. Default: the event's card categories."
          }
        }
      },
      "CompanyEventCards": {
        "type": "object",
        "required": [
          "cards",
          "available",
          "permissions",
          "mode",
          "currencies",
          "categories",
          "maxLimit",
          "gaps"
        ],
        "properties": {
          "cards": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CompanyEventCard"
            }
          },
          "available": {
            "type": "boolean",
            "description": "The company has Travel Code cards, so event cards can be issued."
          },
          "permissions": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "What the caller may do with event cards, `event_card.issue`, `event_card.close`."
          },
          "mode": {
            "type": "string",
            "description": "How the event pays for participants: `company` (the company's payment profile) or `event_card` (event cards)."
          },
          "defaults": {
            "type": [
              "object",
              "null"
            ],
            "description": "The event's card defaults (limit, currency, categories). Issuers only."
          },
          "currencies": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Currencies a limit may be set in. Issuers only, empty otherwise."
          },
          "categories": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Merchant categories that can be allowed. Issuers only, empty otherwise."
          },
          "maxLimit": {
            "type": "number",
            "description": "The highest limit a card may get."
          },
          "account": {
            "type": [
              "object",
              "null"
            ],
            "description": "The card account cards are drawn on, with its currency and conversion rates. Issuers only."
          },
          "gaps": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Holders whose data the issuer still needs (a name in Latin letters, a phone): the caller's own row, or every member's for issuers."
          }
        }
      },
      "CompanyEventContext": {
        "type": "object",
        "properties": {
          "event": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "integer"
              },
              "name": {
                "type": "string"
              },
              "startDate": {
                "type": "string",
                "format": "date"
              },
              "endDate": {
                "type": "string",
                "format": "date"
              },
              "location": {
                "$ref": "#/components/schemas/CompanyEventLocation"
              },
              "windowFrom": {
                "type": "string",
                "format": "date"
              },
              "windowTo": {
                "type": "string",
                "format": "date"
              },
              "services": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "flight",
                    "hotel",
                    "railway",
                    "transfer",
                    "car",
                    "bus",
                    "airbnb"
                  ]
                },
                "description": "Services the caller may book."
              },
              "arrivalAirports": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Configured arrival airports, read by the window check."
              },
              "prefillTo": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Flight form prefill: the first configured arrival airport, else the event city's own airport."
              },
              "prefillFrom": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Flight form prefill: the airport of the caller's departure city."
              },
              "tripDays": {
                "type": "object",
                "properties": {
                  "arrival": {
                    "type": "string",
                    "format": "date"
                  },
                  "return": {
                    "type": "string",
                    "format": "date"
                  }
                },
                "description": "Ground search prefill (hotel, train, bus, transfer, car): the first and last event day, each moved into its part of the window."
              },
              "departureCity": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The caller's departure city as typed; the origin of the train and bus prefill."
              },
              "permissions": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "event_block.organize",
                    "event_block.agent_work",
                    "event_block.cancel"
                  ]
                },
                "description": "The caller's room-block names: with event_block.organize and the event not frozen the hotel card offers \"Add to block shortlist\"."
              },
              "frozen": {
                "type": "boolean",
                "description": "The event is cancelled or closed."
              },
              "blockShortlist": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "description": "Giata ids already on the block shortlist."
              },
              "rules": {
                "type": "object",
                "description": "Booking rules in force for the caller. No amounts: the approval threshold and the budget are not included.",
                "properties": {
                  "window": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "description": "Travel window; null when the event sets no window dates.",
                    "properties": {
                      "arriveFrom": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "format": "date"
                      },
                      "arriveTo": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "format": "date"
                      },
                      "arriveLatestTime": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "description": "HH:MM"
                      },
                      "departFrom": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "format": "date"
                      },
                      "departTo": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "format": "date"
                      },
                      "departEarliestTime": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "description": "HH:MM"
                      },
                      "action": {
                        "type": "string",
                        "enum": [
                          "flag",
                          "approval",
                          "block"
                        ],
                        "description": "What happens to a booking outside the window."
                      }
                    }
                  },
                  "hotel": {
                    "type": "object",
                    "properties": {
                      "mode": {
                        "type": "string",
                        "enum": [
                          "any",
                          "whitelist"
                        ]
                      },
                      "hotels": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        },
                        "description": "Hotel names: the allowed hotels (whitelist) or the recommended ones (any)."
                      }
                    }
                  },
                  "maxCabin": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "enum": [
                      "economy",
                      "economy_premium",
                      "business",
                      "first",
                      null
                    ]
                  },
                  "approval": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "enum": [
                      "all",
                      "threshold",
                      "oop",
                      "never",
                      null
                    ],
                    "description": "Null when the event sets no approval rule."
                  }
                }
              }
            }
          }
        },
        "required": [
          "event"
        ]
      },
      "CompanyEventCreateInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "type": {
            "type": "string",
            "enum": [
              "offsite",
              "sko",
              "conference",
              "retreat",
              "incentive",
              "other"
            ]
          },
          "locationId": {
            "type": [
              "integer",
              "null"
            ]
          },
          "locationName": {
            "type": "string",
            "maxLength": 255
          },
          "venueHotelId": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Accepted and stored; not returned and not used by any rule yet."
          },
          "startDate": {
            "type": "string",
            "format": "date"
          },
          "endDate": {
            "type": "string",
            "format": "date",
            "description": "Not before startDate."
          },
          "targetParticipants": {
            "type": [
              "integer",
              "null"
            ]
          },
          "budgetAmount": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0
          },
          "budgetCurrency": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 3,
            "maxLength": 3
          },
          "costCenterId": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Must be a cost center of the event company."
          },
          "companyId": {
            "type": "integer",
            "description": "Legal entity to create the event in; defaults to the caller current company."
          }
        },
        "required": [
          "name",
          "type",
          "locationName",
          "startDate",
          "endDate"
        ]
      },
      "CompanyEventGuestInput": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "format": "email"
          },
          "firstNameEn": {
            "type": "string",
            "description": "Optional; Latin letters. A guest invited without names is named by the email until they add them."
          },
          "lastNameEn": {
            "type": "string",
            "description": "Optional; Latin letters. A guest invited without names is named by the email until they add them."
          },
          "firstName": {
            "type": "string"
          },
          "lastName": {
            "type": "string"
          },
          "patronymicName": {
            "type": "string"
          },
          "phone": {
            "type": "string"
          },
          "sex": {
            "type": "string"
          },
          "birthDay": {
            "type": "string",
            "format": "date"
          },
          "nationality": {
            "type": "string",
            "description": "ISO country code."
          }
        },
        "required": [
          "email"
        ]
      },
      "CompanyEventInviteInput": {
        "type": "object",
        "properties": {
          "memberIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "minItems": 1
          }
        },
        "required": [
          "memberIds"
        ]
      },
      "CompanyEventList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CompanyEvent"
            }
          },
          "total": {
            "type": "integer"
          },
          "page": {
            "type": "integer"
          },
          "perPage": {
            "type": "integer"
          },
          "counts": {
            "type": "object",
            "description": "Events per tab with the same q and filters, without the tab.",
            "properties": {
              "upcoming": {
                "type": "integer"
              },
              "past": {
                "type": "integer"
              },
              "drafts": {
                "type": "integer"
              }
            }
          },
          "stats": {
            "type": [
              "object",
              "null"
            ],
            "description": "Over the upcoming events the caller runs (owner, co-organizer, company managers, staff), without filters. Null for a caller who runs none and may not create one.",
            "properties": {
              "upcoming": {
                "type": "integer"
              },
              "travellers": {
                "type": "integer",
                "description": "Distinct participants who did not decline."
              },
              "accepted": {
                "type": "integer",
                "description": "Accepted, of those sent a letter."
              },
              "invited": {
                "type": "integer",
                "description": "Sent a letter."
              },
              "budget": {
                "type": [
                  "object",
                  "null"
                ],
                "description": "Budgets the caller may see, restated in companyCurrency.",
                "properties": {
                  "amount": {
                    "type": "number"
                  },
                  "currency": {
                    "type": "string"
                  },
                  "events": {
                    "type": "integer"
                  }
                }
              },
              "organizedOnly": {
                "type": "boolean",
                "description": "True when the caller also sees upcoming events they do not run, so the numbers cover only their own events."
              }
            }
          },
          "companyCurrency": {
            "type": "string",
            "description": "The company's order currency: the default for a new event budget."
          },
          "currencies": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Currencies an event budget may be kept in."
          },
          "permissions": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "event.create"
              ]
            },
            "description": "event.create when the caller may create an event."
          }
        },
        "required": [
          "items",
          "total",
          "page",
          "perPage",
          "permissions"
        ]
      },
      "CompanyEventLocation": {
        "type": "object",
        "properties": {
          "id": {
            "type": [
              "integer",
              "null"
            ]
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "CompanyEventMember": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Member row id, used in the {memberId} paths."
          },
          "userId": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "isGuest": {
            "type": "boolean"
          },
          "email": {
            "type": [
              "string",
              "null"
            ],
            "description": "null without the participants permission."
          },
          "phone": {
            "type": [
              "string",
              "null"
            ],
            "description": "null without the participants permission."
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "co_organizer",
              "participant"
            ]
          },
          "roleLabel": {
            "type": "string"
          },
          "permissions": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "participants",
                "book_for_others",
                "blocks",
                "budget_view",
                "approve"
              ]
            }
          },
          "inviteStatus": {
            "type": "string",
            "enum": [
              "added",
              "invited",
              "accepted",
              "declined"
            ]
          },
          "inviteStatusLabel": {
            "type": "string"
          },
          "invitedAt": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Unix time of the last invitation."
          },
          "departureCity": {
            "type": [
              "string",
              "null"
            ]
          },
          "allowedServices": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "flight": {
                "type": "boolean"
              },
              "hotel": {
                "type": "boolean"
              },
              "railway": {
                "type": "boolean"
              },
              "transfer": {
                "type": "boolean"
              },
              "car": {
                "type": "boolean"
              },
              "bus": {
                "type": "boolean"
              },
              "airbnb": {
                "type": "boolean"
              }
            },
            "description": "Member own flags; only narrow the event services."
          },
          "paymentMode": {
            "type": [
              "string",
              "null"
            ],
            "description": "Returned; no endpoint sets it yet."
          },
          "estimate": {
            "type": [
              "number",
              "null"
            ],
            "description": "Planned spend in the event budget currency (estimateCurrency). Only with budget_view; set through PUT /events/{id}/members/{memberId}."
          },
          "estimateCurrency": {
            "type": [
              "string",
              "null"
            ],
            "description": "The event budget currency (else the company's order currency). Only with budget_view."
          },
          "actual": {
            "oneOf": [
              {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/CompanyEventMoney"
                  }
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "Booked + spent of the member, the same figure as the member's row of GET /events/{id}/budget?groupBy=participant. Only with budget_view."
          },
          "bookings": {
            "type": [
              "integer",
              "null"
            ],
            "description": "null unless the caller can read bookings."
          },
          "outOfWindow": {
            "type": [
              "integer",
              "null"
            ],
            "description": "null unless the caller can read bookings."
          }
        },
        "required": [
          "id",
          "userId",
          "name",
          "isGuest",
          "role",
          "permissions",
          "inviteStatus"
        ]
      },
      "CompanyEventMemberUpdateInput": {
        "type": "object",
        "properties": {
          "estimate": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0,
            "maximum": 1000000000,
            "multipleOf": 0.01,
            "description": "Needs budget_view (403 otherwise). Planned spend in the event budget currency, at most two decimals; null clears it. A closed, completed or cancelled event answers 422."
          },
          "departureCity": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 255,
            "description": "Needs participants."
          },
          "allowedServices": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "flight": {
                    "type": "boolean"
                  },
                  "hotel": {
                    "type": "boolean"
                  },
                  "railway": {
                    "type": "boolean"
                  },
                  "transfer": {
                    "type": "boolean"
                  },
                  "car": {
                    "type": "boolean"
                  },
                  "bus": {
                    "type": "boolean"
                  },
                  "airbnb": {
                    "type": "boolean"
                  }
                }
              },
              {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "flight",
                    "hotel",
                    "railway",
                    "transfer",
                    "car",
                    "bus",
                    "airbnb"
                  ]
                }
              }
            ],
            "description": "Needs participants. A list of names is read as those services set to true."
          },
          "role": {
            "type": "string",
            "enum": [
              "participant",
              "co_organizer"
            ],
            "description": "Needs edit."
          },
          "permissions": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "participants",
                "book_for_others",
                "blocks",
                "budget_view",
                "approve"
              ]
            },
            "description": "Needs edit; co-organizers only."
          },
          "paymentMode": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "company",
              "event_card",
              null
            ],
            "description": "How this participant pays, overriding the event's `settings.payment.mode`; null follows the event. Changing it needs the event-card right (owner or co-organizer with `book_for_others`)."
          }
        },
        "description": "At least one key is required."
      },
      "CompanyEventMembers": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CompanyEventMember"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "CompanyEventMoney": {
        "type": "object",
        "properties": {
          "amount": {
            "type": "number"
          },
          "currency": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "CompanyEventPermissions": {
        "type": "array",
        "items": {
          "type": "string",
          "enum": [
            "event.view",
            "event.edit",
            "event.participants",
            "event.book_for_others",
            "event.blocks",
            "event.budget_view",
            "event.approve",
            "event.bookings_read"
          ]
        },
        "description": "What the caller may do with the event (RecordPermission names); a name not granted is absent. event.edit is the owner's, company managers' and staff's, no permission grants it. event.bookings_read = participants OR book_for_others OR budget_view."
      },
      "CompanyEventPolicySections": {
        "type": "object",
        "properties": {
          "general": {
            "type": "object",
            "properties": {
              "currency": {
                "type": "string"
              }
            },
            "description": "Only `currency` is taken from the client."
          },
          "flight": {
            "type": "object"
          },
          "hotel": {
            "type": "object"
          },
          "railway": {
            "type": "object"
          },
          "transfer": {
            "type": "object"
          },
          "car": {
            "type": [
              "object",
              "null"
            ]
          }
        },
        "description": "Event policy in the shape of the travel policy page rule sections (/v1/travel-policies). On GET `car` is null while the event policy has no car section."
      },
      "CompanyEventRespondInput": {
        "type": "object",
        "properties": {
          "accept": {
            "type": "boolean"
          }
        },
        "required": [
          "accept"
        ]
      },
      "CompanyEventSelectable": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "integer"
                },
                "name": {
                  "type": "string"
                },
                "startDate": {
                  "type": "string",
                  "format": "date"
                },
                "endDate": {
                  "type": "string",
                  "format": "date"
                }
              }
            }
          },
          "defaultId": {
            "type": [
              "integer",
              "null"
            ]
          }
        }
      },
      "CompanyEventSettings": {
        "type": "object",
        "properties": {
          "settings": {
            "type": "object",
            "description": "Stored settings (same keys as the input); {} when none."
          },
          "policy": {
            "$ref": "#/components/schemas/CompanyEventPolicySections"
          },
          "airports": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "title": {
                  "type": "string"
                },
                "titleEn": {
                  "type": "string"
                }
              }
            },
            "description": "Stored arrival airports, in order."
          },
          "suggestedAirports": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "title": {
                  "type": "string"
                },
                "titleEn": {
                  "type": "string"
                }
              }
            },
            "description": "Airports of the event city, offered only while none are stored."
          },
          "hotels": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "integer"
                },
                "name": {
                  "type": "string"
                },
                "address": {
                  "type": "string"
                }
              }
            },
            "description": "Stored hotel list (giata ids) with names."
          },
          "outOfWindow": {
            "type": "integer",
            "description": "Bookings that left the travel window."
          },
          "currencies": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "companyServices": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "flight",
                "hotel",
                "railway",
                "transfer",
                "car",
                "bus",
                "airbnb"
              ]
            },
            "description": "Services the company has turned on."
          },
          "editable": {
            "type": "boolean",
            "description": "false once the event is frozen."
          },
          "policyOrigin": {
            "type": "string",
            "enum": [
              "copied",
              "own",
              "none",
              "none_company_has"
            ],
            "description": "Where the event rules come from. copied = from the company policy at creation; own = set here, the company has none; none = nothing set and no company policy; none_company_has = nothing set although the company now has one."
          }
        },
        "required": [
          "settings",
          "policy",
          "airports",
          "suggestedAirports",
          "hotels",
          "outOfWindow",
          "currencies",
          "companyServices",
          "editable"
        ]
      },
      "CompanyEventSettingsInput": {
        "type": "object",
        "properties": {
          "window": {
            "type": "object",
            "properties": {
              "arriveFrom": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              },
              "arriveTo": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              },
              "departFrom": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              },
              "departTo": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              },
              "arriveLatestTime": {
                "type": [
                  "string",
                  "null"
                ],
                "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$",
                "example": "18:00"
              },
              "departEarliestTime": {
                "type": [
                  "string",
                  "null"
                ],
                "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$",
                "example": "10:00"
              },
              "action": {
                "type": "string",
                "enum": [
                  "flag",
                  "approval",
                  "block"
                ],
                "default": "flag",
                "description": "flag: mark for the organizer; approval: organizers approve; block: refuse. `personal_pay` is reserved, do not send."
              }
            },
            "description": "Replaces the stored window; keys left out are cleared."
          },
          "services": {
            "type": "object",
            "properties": {
              "flight": {
                "type": "boolean"
              },
              "hotel": {
                "type": "boolean"
              },
              "railway": {
                "type": "boolean"
              },
              "transfer": {
                "type": "boolean"
              },
              "car": {
                "type": "boolean"
              },
              "bus": {
                "type": "boolean"
              },
              "airbnb": {
                "type": "boolean"
              }
            },
            "description": "A service not mentioned is allowed. A partial map switches only the services it names."
          },
          "flight": {
            "type": "object",
            "properties": {
              "maxCabin": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "economy",
                  "economy_premium",
                  "business",
                  "first"
                ]
              },
              "arrivalAirports": {
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[A-Za-z]{3}$"
                },
                "description": "IATA codes that exist in our airports table."
              }
            }
          },
          "hotel": {
            "type": "object",
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "any",
                  "whitelist"
                ],
                "default": "any",
                "description": "Any other value is refused with 422."
              },
              "hotelIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "description": "Giata ids from our hotel catalog. At least one for whitelist."
              },
              "prepaid": {
                "type": "boolean",
                "default": true
              },
              "payAtHotel": {
                "type": "boolean",
                "default": true,
                "description": "At least one of prepaid / payAtHotel must be true."
              }
            }
          },
          "approval": {
            "type": "string",
            "enum": [
              "all",
              "threshold",
              "oop",
              "never"
            ]
          },
          "approvalThreshold": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "amount": {
                "type": "number",
                "minimum": 0
              },
              "currency": {
                "type": "string"
              }
            },
            "required": [
              "amount",
              "currency"
            ],
            "description": "Currency from `currencies` of the settings response. Required when approval is threshold."
          },
          "payment": {
            "type": "object",
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "company",
                  "event_card"
                ],
                "default": "company",
                "description": "`event_card` only when the settings response says `eventCards.available`; then `card` {limit, currency, categories} is required."
              },
              "card": {
                "type": "object",
                "description": "Required with `mode` = `event_card`: the defaults every issued card gets.",
                "required": [
                  "limit",
                  "currency",
                  "categories"
                ],
                "properties": {
                  "limit": {
                    "type": "number",
                    "description": "Per-person limit, up to `maxLimit` from `GET /v1/events/{id}/cards`."
                  },
                  "currency": {
                    "type": "string",
                    "description": "ISO 4217 code of the limit."
                  },
                  "categories": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Allowed merchant categories, from `categories` in `GET /v1/events/{id}/cards`."
                  }
                }
              }
            }
          },
          "guestAccess": {
            "type": "object",
            "properties": {
              "rule": {
                "type": "string",
                "enum": [
                  "date",
                  "after_reports"
                ],
                "default": "after_reports"
              },
              "days": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 0,
                "maximum": 365
              }
            }
          }
        },
        "description": "Unknown keys are dropped. A sent section replaces the stored one, except `services`, which merges."
      },
      "CompanyEventSettingsUpdate": {
        "type": "object",
        "properties": {
          "settings": {
            "$ref": "#/components/schemas/CompanyEventSettingsInput"
          },
          "policy": {
            "$ref": "#/components/schemas/CompanyEventPolicySections"
          }
        },
        "description": "Both keys optional and independent."
      },
      "CompanyEventShortlist": {
        "type": "object",
        "properties": {
          "blockId": {
            "type": [
              "integer",
              "null"
            ],
            "description": "The open request that holds the list, null for the draft."
          },
          "hotels": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CompanyEventBlockHotel"
            }
          }
        }
      },
      "CompanyEventStatusInput": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "open",
              "in_progress",
              "completed",
              "closed",
              "cancelled"
            ]
          }
        },
        "required": [
          "status"
        ]
      },
      "CompanyEventUpdateInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "type": {
            "type": "string",
            "enum": [
              "offsite",
              "sko",
              "conference",
              "retreat",
              "incentive",
              "other"
            ]
          },
          "locationId": {
            "type": [
              "integer",
              "null"
            ]
          },
          "locationName": {
            "type": "string",
            "maxLength": 255
          },
          "venueHotelId": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Accepted and stored; not returned and not used by any rule yet."
          },
          "startDate": {
            "type": "string",
            "format": "date"
          },
          "endDate": {
            "type": "string",
            "format": "date",
            "description": "Not before startDate."
          },
          "targetParticipants": {
            "type": [
              "integer",
              "null"
            ]
          },
          "budgetAmount": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0
          },
          "budgetCurrency": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 3,
            "maxLength": 3
          },
          "costCenterId": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Must be a cost center of the event company."
          }
        },
        "description": "Only the keys present change."
      },
      "EventsError": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "description": "Starts with the numeric code, e.g. \"[130] This module is turned off for your company: events\"."
          },
          "code": {
            "type": "integer",
            "description": "5 entity not found, 6 access denied, 130 Events module off."
          },
          "status": {
            "type": "integer"
          }
        },
        "description": "Platform error body for 401 / 403 / 404."
      },
      "EventsValidationErrors": {
        "type": "object",
        "properties": {
          "errors": {
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "description": "Field (or settings path such as `window.arriveTo`) to messages, in the caller language."
          }
        },
        "required": [
          "errors"
        ]
      }
    },
    "parameters": {
      "EventId": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "integer"
        },
        "description": "Event id."
      },
      "MemberId": {
        "name": "memberId",
        "in": "path",
        "required": true,
        "schema": {
          "type": "integer"
        },
        "description": "Member row id (the `id` of a member object), not the user id."
      }
    }
  },
  "security": [],
  "paths": {
    "/v1/news": {
      "get": {
        "tags": [
          "News"
        ],
        "summary": "List published articles (slug -> id)",
        "description": "Paginated listing of articles for one site, oldest first, so a consumer can page through the whole archive and keep its own alias-to-id registry in sync.\n\nRequires a super-admin token (the same one that publishes through POST /v1/news/create).\n\nThe `source` parameter is **required**: without it the response would mix articles of every site we run and return foreign slugs.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "source",
            "in": "query",
            "required": true,
            "description": "Site the articles belong to. `all` disables the filter.",
            "schema": {
              "type": "string",
              "enum": [
                "travelcode",
                "travelhub",
                "bubadrom",
                "all"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 50,
              "minimum": 1,
              "maximum": 500
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 0,
              "minimum": 0
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "`published` (default) keeps articles whose publication date has arrived; `all` returns future-dated ones too. There is no status column — publication is derived from the date.",
            "schema": {
              "type": "string",
              "enum": [
                "published",
                "all"
              ],
              "default": "published"
            }
          },
          {
            "name": "publishedSince",
            "in": "query",
            "description": "Unix timestamp or `YYYY-MM-DD`; keeps articles published at or after it. A malformed value is rejected with 400 rather than silently ignored. There is no equivalent filter on `updatedAt` — use it client-side against the value returned in each item.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "integer",
                            "example": 1386
                          },
                          "alias": {
                            "type": "string",
                            "example": "ultra-low-cost-carriers"
                          },
                          "aliasEn": {
                            "type": "string",
                            "example": "ultra-low-cost-carriers"
                          },
                          "title": {
                            "type": "string"
                          },
                          "titleEn": {
                            "type": "string"
                          },
                          "source": {
                            "type": "string",
                            "example": "travelcode"
                          },
                          "tag": {
                            "type": "string"
                          },
                          "publishedAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time",
                            "example": "2026-08-09T21:00:06Z"
                          },
                          "publishedAtTimestamp": {
                            "type": "integer",
                            "example": 1786309206
                          },
                          "updatedAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time",
                            "example": "2026-09-08T02:10:00Z"
                          },
                          "updatedAtTimestamp": {
                            "type": "integer",
                            "example": 1757297400
                          }
                        }
                      }
                    },
                    "total": {
                      "type": "integer",
                      "example": 703
                    },
                    "offset": {
                      "type": "integer"
                    },
                    "limit": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing/invalid source, status or publishedSince"
          },
          "401": {
            "description": "Missing/invalid Bearer"
          },
          "403": {
            "description": "Token is not a super-admin"
          }
        }
      }
    },
    "/v1/news/by-slug": {
      "get": {
        "tags": [
          "News"
        ],
        "summary": "Resolve an article's numeric id from its slug",
        "description": "Single-article lookup for external tooling that only has a slug (e.g. from a legacy CMS export) and needs the id to call PATCH /v1/news/update/{id}. Matches either `alias` or `aliasEn` — both are globally unique across the whole table, so no `source` parameter is needed.\n\nMachine-to-machine: authenticated by a shared-secret header instead of a Bearer token.",
        "security": [
          {
            "newsApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "query",
            "required": true,
            "description": "Either the RU (`alias`) or EN (`aliasEn`) slug of the article.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "integer",
                      "example": 1386
                    },
                    "alias": {
                      "type": "string",
                      "example": "ultra-low-cost-carriers"
                    },
                    "aliasEn": {
                      "type": "string",
                      "example": "ultra-low-cost-carriers"
                    },
                    "title": {
                      "type": "string"
                    },
                    "titleEn": {
                      "type": "string"
                    },
                    "source": {
                      "type": "string",
                      "example": "travelcode"
                    },
                    "tag": {
                      "type": "string"
                    },
                    "publishedAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time",
                      "example": "2026-08-09T21:00:06Z"
                    },
                    "publishedAtTimestamp": {
                      "type": "integer",
                      "example": 1786309206
                    },
                    "updatedAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time",
                      "example": "2026-09-08T02:10:00Z"
                    },
                    "updatedAtTimestamp": {
                      "type": "integer",
                      "example": 1757297400
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing slug"
          },
          "403": {
            "description": "Missing/invalid X-News-Api-Key"
          },
          "404": {
            "description": "No article with this slug"
          }
        }
      }
    },
    "/order/service/{serviceId}": {
      "patch": {
        "tags": [
          "Orders"
        ],
        "summary": "Set a service's planned netto",
        "description": "Sets the service's planned netto to the given value, applying the same routing as the web “Пересчитать нетто” checkbox: fly / fintech / special-railway keep the planned netto and move cost; every other service moves the planned netto (ordinary avia moves both). Recomputes order totals and logs the change. Idempotent. **Base + auth:** same as `POST /order/bill`.",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": []
          }
        ],
        "parameters": [
          {
            "name": "serviceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Order-service id."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "priceNet",
                  "currency"
                ],
                "properties": {
                  "priceNet": {
                    "type": "number",
                    "description": "New planned netto (>= 0)."
                  },
                  "currency": {
                    "type": "string",
                    "description": "Must equal the order currency (else 422)."
                  },
                  "source": {
                    "type": "string",
                    "description": "Optional audit tag (who/what changed it)."
                  },
                  "note": {
                    "type": "string",
                    "description": "Optional audit note."
                  }
                }
              },
              "example": {
                "priceNet": 281.53,
                "currency": "BYN",
                "source": "CFOLobsterBot"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated service.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "OK"
                    },
                    "orderId": {
                      "type": "integer"
                    },
                    "service": {
                      "type": "object",
                      "properties": {
                        "serviceId": {
                          "type": "integer"
                        },
                        "orderId": {
                          "type": "integer"
                        },
                        "currency": {
                          "type": "string"
                        },
                        "priceGross": {
                          "type": "number"
                        },
                        "priceNet": {
                          "type": "number",
                          "description": "Planned netto after the change."
                        },
                        "priceCost": {
                          "type": "number"
                        },
                        "servicePaid": {
                          "type": "string",
                          "enum": [
                            "yes",
                            "part",
                            "no"
                          ]
                        },
                        "servicePaidAmount": {
                          "type": "number",
                          "description": "Actual amount paid to the partner."
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Service or order not found."
          },
          "422": {
            "description": "Validation error (currency mismatch, bad priceNet, or nothing paid to align to)."
          }
        }
      }
    },
    "/order/service/{serviceId}/close-net": {
      "post": {
        "tags": [
          "Orders"
        ],
        "summary": "Close net — align planned netto to the partner payment",
        "description": "Aligns the service's planned netto to the amount actually paid to the partner (`servicePaidAmount`), like the web “Пересчитать нетто” checkbox (same routing). Recomputes order totals. **422** if nothing has been paid to the partner yet. **Base + auth:** same as `POST /order/bill`.",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": []
          }
        ],
        "parameters": [
          {
            "name": "serviceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Order-service id."
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "source": {
                    "type": "string",
                    "description": "Optional audit tag."
                  },
                  "note": {
                    "type": "string",
                    "description": "Optional audit note."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated service.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "OK"
                    },
                    "orderId": {
                      "type": "integer"
                    },
                    "service": {
                      "type": "object",
                      "properties": {
                        "serviceId": {
                          "type": "integer"
                        },
                        "orderId": {
                          "type": "integer"
                        },
                        "currency": {
                          "type": "string"
                        },
                        "priceGross": {
                          "type": "number"
                        },
                        "priceNet": {
                          "type": "number",
                          "description": "Planned netto after the change."
                        },
                        "priceCost": {
                          "type": "number"
                        },
                        "servicePaid": {
                          "type": "string",
                          "enum": [
                            "yes",
                            "part",
                            "no"
                          ]
                        },
                        "servicePaidAmount": {
                          "type": "number",
                          "description": "Actual amount paid to the partner."
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Service or order not found."
          },
          "422": {
            "description": "Validation error (currency mismatch, bad priceNet, or nothing paid to align to)."
          }
        }
      }
    },
    "/v1/counterparties": {
      "get": {
        "tags": [
          "Counterparties"
        ],
        "summary": "List counterparties",
        "description": "Directory of counterparties for bank-payment auto-match, keyed by tax id (UNP/INN). Unions clients (legal entities), suppliers and a manual directory; de-duplicated by tax id. Read-only.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 200,
              "maximum": 1000
            }
          },
          {
            "name": "updatedSince",
            "in": "query",
            "description": "RFC3339; filters the manual directory only (clients/suppliers are always returned).",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "taxId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "type",
            "in": "query",
            "description": "Filter by role.",
            "schema": {
              "type": "string",
              "enum": [
                "client",
                "supplier",
                "own_entity",
                "partner",
                "bank",
                "government_tax",
                "passthrough",
                "other"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Counterparty"
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer"
                        },
                        "limit": {
                          "type": "integer"
                        },
                        "total": {
                          "type": "integer"
                        },
                        "totalPages": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/counterparties/by-tax-id/{taxIdType}/{taxId}": {
      "get": {
        "tags": [
          "Counterparties"
        ],
        "summary": "Resolve counterparty by tax id",
        "description": "Resolve a single counterparty by UNP/INN — the per-transaction hot path. Read-only.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "taxIdType",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "UNP",
                "INN",
                "OTHER"
              ]
            }
          },
          {
            "name": "taxId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Counterparty"
                }
              }
            }
          },
          "404": {
            "description": "Not in the directory"
          }
        }
      }
    },
    "/v1/auth/jwt/refresh": {
      "post": {
        "tags": [
          "Auth"
        ],
        "summary": "Refresh JWT tokens",
        "description": "Rotates the refresh token and returns a fresh access token. Call before current access token expires.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "refreshToken"
                ],
                "properties": {
                  "refreshToken": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "accessToken": {
                      "type": "string"
                    },
                    "refreshToken": {
                      "type": "string"
                    },
                    "expiresIn": {
                      "type": "integer",
                      "example": 3600
                    },
                    "tokenType": {
                      "type": "string",
                      "example": "Bearer"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/auth/refresh": {
      "put": {
        "tags": [
          "Auth"
        ],
        "summary": "Refresh legacy access token",
        "description": "For accounts still issued non-JWT tokens. Re-issues an access token using existing one as proof. New integrations should use `/v1/auth/jwt/refresh`.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/.well-known/oauth-authorization-server": {
      "servers": [
        {
          "url": "https://travel-code.com",
          "description": "OAuth lives on the main backend, not the /v1 API host"
        }
      ],
      "get": {
        "tags": [
          "Auth"
        ],
        "summary": "OAuth 2.0 discovery (RFC 8414)",
        "description": "Returns OAuth server metadata so clients can auto-configure.",
        "responses": {
          "200": {
            "description": "OAuth metadata",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "example": {
                    "issuer": "https://api.travel-code.com",
                    "authorization_endpoint": "https://api.travel-code.com/oauth/authorize",
                    "token_endpoint": "https://api.travel-code.com/oauth/token",
                    "registration_endpoint": "https://api.travel-code.com/oauth/register",
                    "revocation_endpoint": "https://api.travel-code.com/oauth/revoke",
                    "scopes_supported": [
                      "flights:search",
                      "flights:status",
                      "flights:stats",
                      "airports:read",
                      "airlines:read"
                    ],
                    "response_types_supported": [
                      "code"
                    ],
                    "grant_types_supported": [
                      "authorization_code",
                      "refresh_token"
                    ],
                    "token_endpoint_auth_methods_supported": [
                      "none"
                    ],
                    "code_challenge_methods_supported": [
                      "S256"
                    ]
                  }
                }
              }
            }
          }
        }
      }
    },
    "/oauth/register": {
      "servers": [
        {
          "url": "https://travel-code.com",
          "description": "OAuth lives on the main backend, not the /v1 API host"
        }
      ],
      "post": {
        "tags": [
          "Auth"
        ],
        "summary": "OAuth dynamic client registration",
        "description": "Register a new OAuth client. Public clients (PKCE-only, no client_secret) supported.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "client_name",
                  "redirect_uris"
                ],
                "properties": {
                  "client_name": {
                    "type": "string"
                  },
                  "redirect_uris": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uri"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "client_id": {
                      "type": "string"
                    },
                    "client_secret_expires_at": {
                      "type": "integer",
                      "example": 0
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/oauth/authorize": {
      "servers": [
        {
          "url": "https://travel-code.com",
          "description": "OAuth lives on the main backend, not the /v1 API host"
        }
      ],
      "get": {
        "tags": [
          "Auth"
        ],
        "summary": "OAuth authorize (PKCE)",
        "description": "Begin authorization-code flow. Redirects user-agent back to `redirect_uri` with `?code=...`.",
        "parameters": [
          {
            "name": "response_type",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "code"
              ]
            }
          },
          {
            "name": "client_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "redirect_uri",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uri"
            }
          },
          {
            "name": "scope",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "code_challenge",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "code_challenge_method",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "S256"
              ]
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "302": {
            "description": "Redirect to `redirect_uri` with `?code=...`."
          }
        }
      }
    },
    "/oauth/token": {
      "servers": [
        {
          "url": "https://travel-code.com",
          "description": "OAuth lives on the main backend, not the /v1 API host"
        }
      ],
      "post": {
        "tags": [
          "Auth"
        ],
        "summary": "OAuth token exchange / refresh",
        "description": "Exchange authorization code (or refresh token) for an access token.",
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": [
                  "grant_type"
                ],
                "properties": {
                  "grant_type": {
                    "type": "string",
                    "enum": [
                      "authorization_code",
                      "refresh_token"
                    ]
                  },
                  "code": {
                    "type": "string",
                    "description": "Required for authorization_code."
                  },
                  "refresh_token": {
                    "type": "string",
                    "description": "Required for refresh_token."
                  },
                  "redirect_uri": {
                    "type": "string",
                    "format": "uri"
                  },
                  "client_id": {
                    "type": "string"
                  },
                  "code_verifier": {
                    "type": "string",
                    "description": "Required for authorization_code (PKCE)."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "access_token": {
                      "type": "string"
                    },
                    "refresh_token": {
                      "type": "string"
                    },
                    "token_type": {
                      "type": "string",
                      "example": "Bearer"
                    },
                    "expires_in": {
                      "type": "integer"
                    },
                    "scope": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/oauth/revoke": {
      "servers": [
        {
          "url": "https://travel-code.com",
          "description": "OAuth lives on the main backend, not the /v1 API host"
        }
      ],
      "post": {
        "tags": [
          "Auth"
        ],
        "summary": "OAuth token revoke",
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": [
                  "token"
                ],
                "properties": {
                  "token": {
                    "type": "string",
                    "description": "access_token or refresh_token"
                  },
                  "client_id": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/data/hotel-locations": {
      "get": {
        "tags": [
          "Data Lookups"
        ],
        "summary": "Hotel locations (cities, regions, airports, hotels)",
        "description": "Use `children[].id` as `location` in subsequent search calls. Positive id = city/region; negative id = single hotel by giataId.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Query string (Cyrillic or Latin)."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 15
            }
          },
          {
            "name": "scope",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "onlyNames"
              ]
            },
            "description": "`onlyNames` returns just names."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "items": [
                    {
                      "type": "regions",
                      "text": "Regions",
                      "children": [
                        {
                          "id": 624596,
                          "name": "Tbilisi",
                          "address": "Georgia",
                          "countryCode": "GE"
                        },
                        {
                          "id": 886591,
                          "name": "Tbilisi International Airport – TBS",
                          "address": "Georgia, Tbilisi",
                          "countryCode": "GE"
                        }
                      ]
                    },
                    {
                      "type": "hotels",
                      "text": "Hotels",
                      "children": [
                        {
                          "id": "-449173",
                          "name": "Tbilisi House",
                          "address": "Georgia, Tbilisi, Nasakirali Street 14",
                          "countryCode": "GE"
                        }
                      ]
                    }
                  ],
                  "time": 0.51
                }
              }
            }
          }
        }
      }
    },
    "/v1/data/airports": {
      "get": {
        "tags": [
          "Data Lookups"
        ],
        "summary": "Airports (IATA + city + country)",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/data/airlines": {
      "get": {
        "tags": [
          "Data Lookups"
        ],
        "summary": "Airlines (IATA + name)",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/data/railway-stations": {
      "get": {
        "tags": [
          "Data Lookups"
        ],
        "summary": "Train stations",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/data/locations-autocomplete": {
      "get": {
        "tags": [
          "Data Lookups"
        ],
        "summary": "Google Places autocomplete (transfers)",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/data/google-place-details": {
      "get": {
        "tags": [
          "Data Lookups"
        ],
        "summary": "Resolve Google Place ID",
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Google Place ID."
          }
        ],
        "responses": {
          "200": {
            "description": "Coordinates / address."
          }
        }
      }
    },
    "/v1/data/countries": {
      "get": {
        "tags": [
          "Data Lookups"
        ],
        "summary": "Countries (ISO + nationality)",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/data/hotels/filters": {
      "get": {
        "tags": [
          "Data Lookups"
        ],
        "summary": "Available hotel filter values per market",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/data/vocabulary": {
      "get": {
        "tags": [
          "Data Lookups"
        ],
        "summary": "Translated UI strings (boards, property types, cabin classes)",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/search/hotels/stream": {
      "post": {
        "tags": [
          "Hotel Search"
        ],
        "summary": "Stream search (SSE)",
        "description": "**Content-Type:** `text/event-stream`. Server timeout 120s — set client `--max-time 130`. Pair with `Cache-Control: no-cache` on intermediaries.\n\n**Event types:**\n- `connected` — first event: `{\"status\": \"ok\"}` (or `\"cached\": true`)\n- `hotels` — recommend mode: `{batch, count, hotels[]}`\n- `sorted_hotels` — recommend mode: `{count, total, chunk, hotels[]}`\n- `count` — progress: `{batch, count, total}`\n- `completed` — end: `{count, hotels[], cacheKey}`\n- `error` / `timeout` — failures\n\nIn recommend mode hotels arrive via `hotels`/`sorted_hotels` and `completed.hotels` is empty. In price mode only `count` streams and `completed` carries the sorted page.\n\n`cacheKey` from `completed` is used downstream by `/search-names`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "location",
                  "checkin",
                  "checkout",
                  "countryCode",
                  "guests"
                ],
                "properties": {
                  "location": {
                    "oneOf": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "Location id from `/v1/data/hotel-locations`. Positive id = city/region; negative id = single hotel by giataId."
                  },
                  "checkin": {
                    "type": "string",
                    "format": "date",
                    "example": "2026-06-10"
                  },
                  "checkout": {
                    "type": "string",
                    "format": "date",
                    "example": "2026-06-13",
                    "description": "Stay length capped at 28 nights; otherwise checkin is back-shifted."
                  },
                  "countryCode": {
                    "type": "string",
                    "example": "UK",
                    "description": "Guest nationality ISO code."
                  },
                  "guests": {
                    "$ref": "#/components/schemas/Guests"
                  },
                  "offset": {
                    "type": "integer",
                    "description": "stream/list pagination offset."
                  },
                  "limit": {
                    "type": "integer",
                    "description": "stream/list page size."
                  },
                  "sort": {
                    "type": "string",
                    "enum": [
                      "recommend",
                      "price"
                    ],
                    "default": "recommend"
                  },
                  "filter": {
                    "$ref": "#/components/schemas/HotelFilter"
                  },
                  "id": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "`/list` only: restrict result to a set of giataIds."
                  },
                  "mapBoundsSwLat": {
                    "type": "number",
                    "format": "float",
                    "example": 41.3431
                  },
                  "mapBoundsSwLng": {
                    "type": "number",
                    "format": "float",
                    "example": 2.0695
                  },
                  "mapBoundsNeLat": {
                    "type": "number",
                    "format": "float",
                    "example": 41.4696
                  },
                  "mapBoundsNeLng": {
                    "type": "number",
                    "format": "float",
                    "example": 2.228
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "SSE stream",
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "Server-Sent Events stream — see event types in description."
                }
              }
            }
          }
        }
      }
    },
    "/v1/search/hotels/list": {
      "post": {
        "tags": [
          "Hotel Search"
        ],
        "summary": "List from cache (page of hotel cards)",
        "description": "Reads a JSON page of hotel cards from the cache populated by `/v1/search/hotels/stream`. **Cache-only — does not run a new search.** Must be called within the 15-minute TTL after stream. Body identical to stream + requires `id` (one or more giataIds) to scope the result.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "type": "object",
                    "required": [
                      "location",
                      "checkin",
                      "checkout",
                      "countryCode",
                      "guests"
                    ],
                    "properties": {
                      "location": {
                        "oneOf": [
                          {
                            "type": "integer"
                          },
                          {
                            "type": "string"
                          }
                        ],
                        "description": "Location id from `/v1/data/hotel-locations`. Positive id = city/region; negative id = single hotel by giataId."
                      },
                      "checkin": {
                        "type": "string",
                        "format": "date",
                        "example": "2026-06-10"
                      },
                      "checkout": {
                        "type": "string",
                        "format": "date",
                        "example": "2026-06-13",
                        "description": "Stay length capped at 28 nights; otherwise checkin is back-shifted."
                      },
                      "countryCode": {
                        "type": "string",
                        "example": "UK",
                        "description": "Guest nationality ISO code."
                      },
                      "guests": {
                        "$ref": "#/components/schemas/Guests"
                      },
                      "offset": {
                        "type": "integer",
                        "description": "stream/list pagination offset."
                      },
                      "limit": {
                        "type": "integer",
                        "description": "stream/list page size."
                      },
                      "sort": {
                        "type": "string",
                        "enum": [
                          "recommend",
                          "price"
                        ],
                        "default": "recommend"
                      },
                      "filter": {
                        "$ref": "#/components/schemas/HotelFilter"
                      },
                      "id": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        },
                        "description": "`/list` only: restrict result to a set of giataIds."
                      },
                      "mapBoundsSwLat": {
                        "type": "number",
                        "format": "float",
                        "example": 41.3431
                      },
                      "mapBoundsSwLng": {
                        "type": "number",
                        "format": "float",
                        "example": 2.0695
                      },
                      "mapBoundsNeLat": {
                        "type": "number",
                        "format": "float",
                        "example": 41.4696
                      },
                      "mapBoundsNeLng": {
                        "type": "number",
                        "format": "float",
                        "example": 2.228
                      }
                    }
                  },
                  {
                    "required": [
                      "id"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "count": 424,
                  "hotels": [
                    {
                      "id": 1431950,
                      "price": 91,
                      "total": 181,
                      "refundable": true,
                      "hotelNames": {
                        "mainName": "ibis Styles Old Tbilisi",
                        "alsoKnownNames": ""
                      },
                      "propertyName": "Ibis Styles Old Tbilisi",
                      "heroImage": "https://i.travelapi.com/lodging/.../a6f3c23b_b.jpg",
                      "description": "In Tbilisi (Tbilisi City Centre)",
                      "ratings": {
                        "count": 6,
                        "overall": "4.2",
                        "reviews": "reviews",
                        "text": "excellent"
                      },
                      "starRating": 4,
                      "longitude": "44.80655043",
                      "latitude": "41.69122488",
                      "meal": "Breakfast included",
                      "availableRooms": null
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/search/hotels/map": {
      "post": {
        "tags": [
          "Hotel Search"
        ],
        "summary": "Map (minimal geo points)",
        "description": "Cache-only, like `/list`. Returns one entry per hotel with `id`, `latitude`, `longitude`, `price`. Use `mapBounds*` quad to scope to viewport.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "location",
                  "checkin",
                  "checkout",
                  "countryCode",
                  "guests"
                ],
                "properties": {
                  "location": {
                    "oneOf": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "Location id from `/v1/data/hotel-locations`. Positive id = city/region; negative id = single hotel by giataId."
                  },
                  "checkin": {
                    "type": "string",
                    "format": "date",
                    "example": "2026-06-10"
                  },
                  "checkout": {
                    "type": "string",
                    "format": "date",
                    "example": "2026-06-13",
                    "description": "Stay length capped at 28 nights; otherwise checkin is back-shifted."
                  },
                  "countryCode": {
                    "type": "string",
                    "example": "UK",
                    "description": "Guest nationality ISO code."
                  },
                  "guests": {
                    "$ref": "#/components/schemas/Guests"
                  },
                  "offset": {
                    "type": "integer",
                    "description": "stream/list pagination offset."
                  },
                  "limit": {
                    "type": "integer",
                    "description": "stream/list page size."
                  },
                  "sort": {
                    "type": "string",
                    "enum": [
                      "recommend",
                      "price"
                    ],
                    "default": "recommend"
                  },
                  "filter": {
                    "$ref": "#/components/schemas/HotelFilter"
                  },
                  "id": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "`/list` only: restrict result to a set of giataIds."
                  },
                  "mapBoundsSwLat": {
                    "type": "number",
                    "format": "float",
                    "example": 41.3431
                  },
                  "mapBoundsSwLng": {
                    "type": "number",
                    "format": "float",
                    "example": 2.0695
                  },
                  "mapBoundsNeLat": {
                    "type": "number",
                    "format": "float",
                    "example": 41.4696
                  },
                  "mapBoundsNeLng": {
                    "type": "number",
                    "format": "float",
                    "example": 2.228
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "count": 142,
                  "hotels": [
                    {
                      "id": 1431950,
                      "latitude": 41.6912,
                      "longitude": 44.8066,
                      "price": 91
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/search/hotels/search-names": {
      "get": {
        "tags": [
          "Hotel Search"
        ],
        "summary": "Filter cached search by hotel name",
        "description": "Returns up to 100 hits sorted by relevance. `ck` is the `cacheKey` returned in `completed` (must match `^{unified}:(stream:prices|filter):...`).",
        "parameters": [
          {
            "name": "ck",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Cache key from stream `completed` event."
          },
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Name query."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": [
                  {
                    "id": 1431950,
                    "name": "Ibis Styles Old Tbilisi",
                    "score": 0.93
                  }
                ]
              }
            }
          }
        }
      }
    },
    "/v1/search/hotels/offers": {
      "post": {
        "tags": [
          "Hotel Search"
        ],
        "summary": "Single-hotel offers (rate plans + content)",
        "description": "Returns all available rate plans for a single hotel plus the hotel content (name, star rating, address, images, description, geo coordinates). Served from layered 15-min caches with fallback to live supplier query. Pass the same `location`/`checkin`/`checkout`/`guests` as the prior `stream` search to maximize cache hits.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "id",
                  "checkin",
                  "checkout",
                  "countryCode",
                  "guests"
                ],
                "properties": {
                  "id": {
                    "type": "integer",
                    "description": "Hotel giataId."
                  },
                  "checkin": {
                    "type": "string",
                    "format": "date"
                  },
                  "checkout": {
                    "type": "string",
                    "format": "date"
                  },
                  "countryCode": {
                    "type": "string"
                  },
                  "guests": {
                    "$ref": "#/components/schemas/Guests"
                  },
                  "location": {
                    "oneOf": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "Optional — same as prior stream call, enables cache reuse."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "sessionId": "69f38317223480.46921054",
                  "property": {
                    "id": "69923287",
                    "address": "Georgia, Tiflis, Kote Abkhazi 39",
                    "name": "Ibis Styles Old Tbilisi",
                    "heroImage": "https://api-img.hotelston.com/.../958699859.jpg",
                    "starRating": 4,
                    "longitude": 44.80655170000001,
                    "latitude": 41.6912095,
                    "checkin": {
                      "minAge": 18,
                      "beginTime": "15:00",
                      "endTime": null,
                      "time": null
                    },
                    "checkout": {
                      "beginTime": "12:00",
                      "endTime": null,
                      "time": null
                    },
                    "phone": "+995322002022",
                    "city": "Tiflis",
                    "country": "Georgia"
                  },
                  "offers": {
                    "Standard Double Room": {
                      "content": {
                        "area": "17.0",
                        "views": null,
                        "photos": [
                          "..."
                        ]
                      },
                      "rates": [
                        {
                          "id": "5e266508-dee21a18-6599dbce-9dabfbe3",
                          "hotelCode": "1431950",
                          "price": {
                            "currency": "USD",
                            "total": 181.2,
                            "nightly": 90.6,
                            "nights": 2,
                            "extra": 0,
                            "rooms": 1,
                            "totalWithExtra": 181.2,
                            "deposit": null
                          },
                          "cancelPolicy": {
                            "refundable": true,
                            "rules": [
                              {
                                "deadline": "2026-06-14 11:00:00",
                                "type": "amount",
                                "value": 75
                              },
                              {
                                "deadline": "2026-06-15 00:00:00",
                                "type": "amount",
                                "value": 151
                              }
                            ],
                            "title": "Free cancellation until 09.06.2026 11:00",
                            "description": "<p>...</p>",
                            "fullyRefundable": false
                          },
                          "remarks": "",
                          "roomName": "Standard Double room (full double bed)",
                          "boardName": "Breakfast included"
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/search/flights": {
      "post": {
        "tags": [
          "Flight Search"
        ],
        "summary": "Kick off flight search",
        "description": "Returns `cacheId`. Poll `/v1/search/flights/{cacheId}` until `status: completed`. Two shapes: simple round-trip (`locationFrom/To/date[/dateEnd]`) or multi-leg (`routes[]/routeDates[]`).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "cabinClass",
                  "adults",
                  "children",
                  "infants"
                ],
                "properties": {
                  "locationFrom": {
                    "type": "string",
                    "description": "Simple round-trip/one-way only. IATA code (e.g. LON, JFK)."
                  },
                  "locationTo": {
                    "type": "string",
                    "description": "Simple round-trip/one-way only."
                  },
                  "date": {
                    "type": "string",
                    "description": "Simple: outbound date `DD.MM.YYYY`."
                  },
                  "dateEnd": {
                    "type": "string",
                    "description": "Optional return date `DD.MM.YYYY` (omit for one-way)."
                  },
                  "routes": {
                    "type": "array",
                    "description": "Multi-leg/complex: each item is `{locationFrom, locationTo}`.",
                    "items": {
                      "type": "object",
                      "properties": {
                        "locationFrom": {
                          "type": "string"
                        },
                        "locationTo": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "routeDates": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Multi-leg: same length as `routes[]`, each in `DD.MM.YYYY`."
                  },
                  "cabinClass": {
                    "type": "string",
                    "enum": [
                      "economy",
                      "premiumEconomy",
                      "business",
                      "first"
                    ]
                  },
                  "adults": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9
                  },
                  "children": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9,
                    "description": "Ages 2–11."
                  },
                  "infants": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9,
                    "description": "Under 2."
                  },
                  "currency": {
                    "type": "string",
                    "description": "ISO override (GBP/EUR/USD)."
                  },
                  "airlines": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Restrict to marketing carriers (IATA codes)."
                  },
                  "onlyCharter": {
                    "type": "integer",
                    "enum": [
                      0,
                      1
                    ],
                    "description": "1 to limit to charter inventory."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "cacheId": "f9c84b32-7d2f-4a3e-93bd-...",
                  "status": "pending",
                  "etaMs": 12000
                }
              }
            }
          }
        }
      }
    },
    "/v1/search/flights/{cacheId}": {
      "get": {
        "tags": [
          "Flight Search"
        ],
        "summary": "Read flight search result (poll)",
        "description": "Returns cached search result. Poll until `status: completed`. Partial results returned with `status: pending`.\n\n**Prices.** `items[].totalPriceNet` is the client price: the airline fare plus the Travel Code service fee configured for the buyer's company (corporate or standard rate, the company's own fee per supplier, the storefront's fee rules), in the offer currency. An order created from the offer (`POST /v1/orders`) is priced the same way, so this is what the client pays.\n\n- Integrators (OAuth, API token, widget token): `items[].totalPrice` equals `items[].totalPriceNet`; `items[].items[].price.totalPrice` is the client price of that flight (fee included). Display either.\n- Admins (session): `items[].totalPrice` is the fare without our fee, plus the NET breakdown (`price.inclusivePrice`, `exclusivePrice`, `priceForSearch`).\n- Company service fees configured per traveller or per service (e.g. hotel fees) are added to the order as separate service-fee lines.\n\n**Price breakdown.** Each offer carries `priceBreakdown` (not for widget-token callers): `baseFare + taxes.total + carrierFees + serviceFee (+ agentMarkup when the searching agency added one) = total`, the client price. Search results give taxes as one total (`taxes.itemized: false`); the per-code split (`taxes.lines`, e.g. YQ, XT) appears on the booked order when the supplier returns it.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "cacheId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "status": "completed",
                  "cacheId": "5vW1Fol0gv5PKjaPI1ZzUlPROThOLM-z",
                  "items": [
                    {
                      "id": "a1b2c3_159.23",
                      "totalPrice": 159.23,
                      "totalPriceNet": 159.23,
                      "durationTime": "01:20",
                      "items": [
                        {
                          "service": "amadeus_ndc",
                          "airline": "LO",
                          "cabinClass": "economy",
                          "price": {
                            "currency": "USD",
                            "totalPrice": 159.23
                          },
                          "itineraries": [
                            {
                              "segments": [
                                {
                                  "departure": {
                                    "iata_code": "WAW",
                                    "at": "2026-12-10T15:30:00"
                                  },
                                  "arrival": {
                                    "iata_code": "VIE",
                                    "at": "2026-12-10T16:50:00"
                                  },
                                  "carrierCode": "LO",
                                  "number": "221"
                                }
                              ]
                            }
                          ]
                        }
                      ],
                      "priceBreakdown": {
                        "currency": "USD",
                        "baseFare": 96.4,
                        "taxes": {
                          "total": 51.7,
                          "itemized": false,
                          "lines": []
                        },
                        "carrierFees": 0,
                        "serviceFee": 11.13,
                        "total": 159.23
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/search/flights/calendar": {
      "post": {
        "tags": [
          "Flight Search"
        ],
        "summary": "Flight calendar (date-flex)",
        "description": "Returns lowest available fare per day across a window. Body is a subset of `/v1/search/flights` plus `period` (days).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "type": "object",
                    "required": [
                      "cabinClass",
                      "adults",
                      "children",
                      "infants"
                    ],
                    "properties": {
                      "locationFrom": {
                        "type": "string",
                        "description": "Simple round-trip/one-way only. IATA code (e.g. LON, JFK)."
                      },
                      "locationTo": {
                        "type": "string",
                        "description": "Simple round-trip/one-way only."
                      },
                      "date": {
                        "type": "string",
                        "description": "Simple: outbound date `DD.MM.YYYY`."
                      },
                      "dateEnd": {
                        "type": "string",
                        "description": "Optional return date `DD.MM.YYYY` (omit for one-way)."
                      },
                      "routes": {
                        "type": "array",
                        "description": "Multi-leg/complex: each item is `{locationFrom, locationTo}`.",
                        "items": {
                          "type": "object",
                          "properties": {
                            "locationFrom": {
                              "type": "string"
                            },
                            "locationTo": {
                              "type": "string"
                            }
                          }
                        }
                      },
                      "routeDates": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        },
                        "description": "Multi-leg: same length as `routes[]`, each in `DD.MM.YYYY`."
                      },
                      "cabinClass": {
                        "type": "string",
                        "enum": [
                          "economy",
                          "premiumEconomy",
                          "business",
                          "first"
                        ]
                      },
                      "adults": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 9
                      },
                      "children": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9,
                        "description": "Ages 2–11."
                      },
                      "infants": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9,
                        "description": "Under 2."
                      },
                      "currency": {
                        "type": "string",
                        "description": "ISO override (GBP/EUR/USD)."
                      },
                      "airlines": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        },
                        "description": "Restrict to marketing carriers (IATA codes)."
                      },
                      "onlyCharter": {
                        "type": "integer",
                        "enum": [
                          0,
                          1
                        ],
                        "description": "1 to limit to charter inventory."
                      }
                    }
                  },
                  {
                    "properties": {
                      "period": {
                        "type": "integer",
                        "description": "Window in days."
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "sessionId": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/search/flights/calendar/{sessionId}": {
      "get": {
        "tags": [
          "Flight Search"
        ],
        "summary": "Read calendar result",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/search/flights/comparison-table": {
      "post": {
        "tags": [
          "Flight Search"
        ],
        "summary": "Fare-class comparison table",
        "description": "Same itinerary across all available fare families (Light/Standard/Flex/Business/etc.). `offerId` anchors the table.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "type": "object",
                    "required": [
                      "cabinClass",
                      "adults",
                      "children",
                      "infants"
                    ],
                    "properties": {
                      "locationFrom": {
                        "type": "string",
                        "description": "Simple round-trip/one-way only. IATA code (e.g. LON, JFK)."
                      },
                      "locationTo": {
                        "type": "string",
                        "description": "Simple round-trip/one-way only."
                      },
                      "date": {
                        "type": "string",
                        "description": "Simple: outbound date `DD.MM.YYYY`."
                      },
                      "dateEnd": {
                        "type": "string",
                        "description": "Optional return date `DD.MM.YYYY` (omit for one-way)."
                      },
                      "routes": {
                        "type": "array",
                        "description": "Multi-leg/complex: each item is `{locationFrom, locationTo}`.",
                        "items": {
                          "type": "object",
                          "properties": {
                            "locationFrom": {
                              "type": "string"
                            },
                            "locationTo": {
                              "type": "string"
                            }
                          }
                        }
                      },
                      "routeDates": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        },
                        "description": "Multi-leg: same length as `routes[]`, each in `DD.MM.YYYY`."
                      },
                      "cabinClass": {
                        "type": "string",
                        "enum": [
                          "economy",
                          "premiumEconomy",
                          "business",
                          "first"
                        ]
                      },
                      "adults": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 9
                      },
                      "children": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9,
                        "description": "Ages 2–11."
                      },
                      "infants": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9,
                        "description": "Under 2."
                      },
                      "currency": {
                        "type": "string",
                        "description": "ISO override (GBP/EUR/USD)."
                      },
                      "airlines": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        },
                        "description": "Restrict to marketing carriers (IATA codes)."
                      },
                      "onlyCharter": {
                        "type": "integer",
                        "enum": [
                          0,
                          1
                        ],
                        "description": "1 to limit to charter inventory."
                      }
                    }
                  },
                  {
                    "properties": {
                      "offerId": {
                        "type": "string",
                        "description": "Anchor offer."
                      }
                    },
                    "required": [
                      "offerId"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/search/flights/comparison-table/{sessionId}": {
      "get": {
        "tags": [
          "Flight Search"
        ],
        "summary": "Read comparison-table result",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/search/trains": {
      "post": {
        "tags": [
          "Train Search"
        ],
        "summary": "Kick off train search",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "route",
                  "locationFrom",
                  "locationTo",
                  "date",
                  "timeTo",
                  "dateTo",
                  "timeReturn",
                  "adults",
                  "children",
                  "guests",
                  "service"
                ],
                "properties": {
                  "route": {
                    "type": "integer",
                    "enum": [
                      1,
                      2
                    ],
                    "description": "1 one-way, 2 round-trip."
                  },
                  "locationFrom": {
                    "type": "string",
                    "description": "Station `id` (a number) from `GET /v1/data/transport-stations?transportType=train` or `GET /v1/data/railway-stations` — not the station `code`; an unknown id is refused with `404` code `12`."
                  },
                  "locationTo": {
                    "type": "string",
                    "description": "Station `id` (a number) from `GET /v1/data/transport-stations?transportType=train` or `GET /v1/data/railway-stations` — not the station `code`; an unknown id is refused with `404` code `12`."
                  },
                  "date": {
                    "type": "string",
                    "description": "Outbound `DD.MM.YYYY`."
                  },
                  "timeTo": {
                    "type": "string",
                    "description": "Outbound earliest time `HH:MM`."
                  },
                  "dateTo": {
                    "type": "string",
                    "description": "Return date — round-trip only. The key must be present: send an empty string for one-way."
                  },
                  "timeReturn": {
                    "type": "string",
                    "description": "Return earliest time — round-trip only. The key must be present: send an empty string for one-way."
                  },
                  "adults": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9,
                    "description": "The key must be present, but passengers are counted from `guests`: put every passenger there."
                  },
                  "children": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9,
                    "description": "The key must be present, but passengers are counted from `guests`."
                  },
                  "childAges": {
                    "type": "array",
                    "items": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 17
                    },
                    "description": "Required when children > 0."
                  },
                  "seniors": {
                    "type": "integer",
                    "description": "60+ passengers."
                  },
                  "cabinClass": {
                    "type": "string",
                    "enum": [
                      "economy",
                      "business",
                      "first"
                    ],
                    "default": "economy"
                  },
                  "service": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "The key must be present (send `[]`). Restricting carriers applies to our staff only; for other callers it is ignored."
                  },
                  "guests": {
                    "$ref": "#/components/schemas/Guests"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "cacheId": "tr-9f2e...",
                  "status": "pending"
                }
              }
            }
          }
        },
        "description": "\n\n**Required keys.** Every key in `required` must be present even when unused (empty string or `[]`), otherwise `400` code `4`. Passengers are taken from `guests` (send one entry); top-level `adults` / `children` are not used for the count."
      }
    },
    "/v1/search/trains/{cacheId}": {
      "get": {
        "tags": [
          "Train Search"
        ],
        "summary": "Read train search result",
        "description": "Offers grouped by carrier, with seat classes, fares, refundability. Each offer has `id` used as `offerId` on order creation.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "cacheId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/search/transfers": {
      "post": {
        "tags": [
          "Transfer Search"
        ],
        "summary": "Search transfers (synchronous)",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "route",
                  "locationFrom",
                  "locationTo",
                  "locationFromText",
                  "locationToText",
                  "locationFromToken",
                  "locationToToken",
                  "dateTo",
                  "timeTo",
                  "adults",
                  "children"
                ],
                "properties": {
                  "route": {
                    "type": "integer",
                    "enum": [
                      1,
                      2
                    ]
                  },
                  "locationFrom": {
                    "type": "string",
                    "description": "Google Place ID (from `/v1/data/locations-autocomplete`)."
                  },
                  "locationTo": {
                    "type": "string"
                  },
                  "locationFromText": {
                    "type": "string",
                    "description": "Human-readable address."
                  },
                  "locationToText": {
                    "type": "string"
                  },
                  "locationFromToken": {
                    "type": "string",
                    "description": "Google session token used at autocomplete time."
                  },
                  "locationToToken": {
                    "type": "string"
                  },
                  "dateTo": {
                    "type": "string",
                    "description": "Pickup `DD.MM.YYYY`."
                  },
                  "timeTo": {
                    "type": "string",
                    "description": "Pickup `HH:MM`."
                  },
                  "dateReturn": {
                    "type": "string",
                    "description": "Round-trip only."
                  },
                  "timeReturn": {
                    "type": "string",
                    "description": "Round-trip only."
                  },
                  "adults": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 8
                  },
                  "children": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 6
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "offers": [
                    {
                      "id": "iway-...",
                      "supplier": "iway",
                      "category": "economy",
                      "vehicle": {
                        "make": "Skoda",
                        "model": "Octavia",
                        "capacity": 3
                      },
                      "price": {
                        "total": 35.0,
                        "currency": "GBP"
                      },
                      "cancelable": true
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/orders": {
      "post": {
        "tags": [
          "Orders"
        ],
        "summary": "Create order",
        "description": "Books a service from a search result. The supplier step is finished asynchronously by queue workers — the response is immediate (order in `pre_payment` / `in_progress`); the final state comes from `GET /v1/orders/{id}`.\n\nFor hotels: if the supplier's price has drifted since search, returns `409 Conflict` with the new price-check payload — call again with the same `bookKey` to confirm at the new price.\n\nUse `Idempotency-Key` header to dedupe retries (24h window).\n\n### Booking checklist (read before integrating)\n\n1. **Who travels.** `GET /v1/user/me` → `travelerId` is the caller's own traveller card (the card bridged to the account, else the one pinned as theirs — not simply their oldest card). People the caller booked before: `GET /v1/user/recent-travelers` (passport numbers masked). Full document numbers: `GET /v1/clients/{id}/documents`. Use the card's Latin names, not the account name — they can differ (account \"Egor\", passport \"YAHOR\").\n2. **Search.**\n   - Flights: `POST /v1/search/flights` → poll `GET /v1/search/flights/{cacheId}` until it finishes. Book with `sessionId` = `cacheId` and `offerId` = the offer's `id` exactly as served. **Never send a list position or index** — results are re-sorted between polls and an index books a different flight; the server rejects it.\n   - Hotels: stream/list → `POST /v1/search/hotels/offers` → `sessionId` from that call, `offerId` = `offers[<room>].rates[].id`.\n3. **Passengers / guests.** Flights: `passengers[]` (`Passenger`). Hotels: `rooms[].guests[]` (`HotelGuest`, `type` required). Dates `YYYY-MM-DD`. Always send `nationality` and a phone with the country code.\n4. **Create.** `POST /v1/orders` with an `Idempotency-Key` header. The answer is immediate; the supplier step runs in a queue.\n5. **Check the outcome — do not assume success from HTTP 200.**\n   - `booking.status = \"failed\"` in the response → the supplier refused; the order stays as a request for a manager, nothing is held. Tell the user so.\n   - Otherwise poll `GET /v1/orders/{id}`: the flight service gets the airline record (PNR) and a ticketing deadline. Unpaid bookings are released by the airline after that deadline.\n6. **Cancel.** `GET /v1/orders/{id}/cancel/check` (penalty) → `POST /v1/orders/{id}/cancel`. The answer is `pending_cancellation`; the supplier cancel runs in a queue — poll the order until `canceled`.\n7. **Audit.** Every order records who created and cancelled it, through which channel, in the order journal.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Same key within 24h returns the prior order."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "serviceType",
                  "sessionId",
                  "offerId"
                ],
                "properties": {
                  "serviceType": {
                    "type": "string",
                    "enum": [
                      "flight",
                      "hotel",
                      "train",
                      "transfer"
                    ]
                  },
                  "sessionId": {
                    "type": "string",
                    "description": "`cacheId` (flights/trains) or `sessionId` (hotels) from search."
                  },
                  "offerId": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "integer"
                      }
                    ],
                    "description": "Flights/trains: the offer `id` exactly as returned by the search poll (opaque string; never a list index). Hotels: `offers[<roomName>].rates[].id`."
                  },
                  "passengers": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/Passenger"
                    },
                    "description": "Required for flight/train. See `Passenger` — note `dateOfBirth`, `nationality`, `document.expiryDate`."
                  },
                  "rooms": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/RoomGuests"
                    },
                    "description": "Required for hotel. One entry per room; see `HotelGuest` (`type` is required)."
                  },
                  "paymentMethod": {
                    "type": "string",
                    "description": "card / deposit / bill / etc. Override default."
                  },
                  "bookKey": {
                    "type": "string",
                    "description": "Hotel-only: idempotency hint for repeated price-check confirmations."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Order created. Check `booking.status` before telling the user the booking is held.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "order": {
                      "type": "object",
                      "description": "The order envelope (same shape as `GET /v1/orders/{id}`)."
                    },
                    "booking": {
                      "type": "object",
                      "description": "Present only when the supplier refused the booking.",
                      "properties": {
                        "status": {
                          "type": "string",
                          "enum": [
                            "failed"
                          ]
                        },
                        "reason": {
                          "type": "string"
                        }
                      }
                    }
                  }
                },
                "examples": {
                  "held": {
                    "summary": "Booking accepted by the supplier",
                    "value": {
                      "order": {
                        "id": 57975,
                        "code": "GB260611005",
                        "status": "pre_payment",
                        "currency": "USD",
                        "priceGross": 288.4,
                        "payPrice": 288.4,
                        "paid": 0,
                        "services": [],
                        "clients": []
                      }
                    }
                  },
                  "failed": {
                    "summary": "Supplier refused — nothing is held",
                    "value": {
                      "order": {
                        "id": 57976,
                        "code": "GB260611006",
                        "status": "new"
                      },
                      "booking": {
                        "status": "failed",
                        "reason": "The supplier did not accept the booking; the request was passed to a manager."
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Hotel price drift — re-call with same bookKey."
          },
          "400": {
            "description": "Validation error. The message names the field path, e.g. `passengers.0.dateOfBirth must use YYYY-MM-DD or DD.MM.YYYY format`, `rooms.0.guests.0.nationality is required`, or an unknown/stale `offerId`."
          }
        }
      },
      "get": {
        "tags": [
          "Orders"
        ],
        "summary": "List orders (filtered)",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "code",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Order code (exact match)."
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "oneOf": [
                {
                  "type": "string"
                },
                {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "enum": [
                      "pre_order",
                      "pre_payment",
                      "pre_book",
                      "finish",
                      "canceled"
                    ]
                  }
                }
              ]
            }
          },
          {
            "name": "pnr",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Air PNR."
          },
          {
            "name": "passengerName",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Substring match on passenger last name."
          },
          {
            "name": "countryId",
            "in": "query",
            "schema": {
              "oneOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "array",
                  "items": {
                    "type": "integer"
                  }
                }
              ]
            },
            "description": "Country id (single or array: countryId[]=11)."
          },
          {
            "name": "buyerId",
            "in": "query",
            "schema": {
              "oneOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "array",
                  "items": {
                    "type": "integer"
                  }
                }
              ]
            },
            "description": "Buyer user id (single or array)."
          },
          {
            "name": "paymentStatus",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "yes",
                "no",
                "partial"
              ]
            }
          },
          {
            "name": "dateFrom",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "dateTo",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "tourBeginFrom",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "tourBeginTo",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "tourEndFrom",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "tourEndTo",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "agencyId",
            "in": "query",
            "schema": {
              "oneOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "array",
                  "items": {
                    "type": "integer"
                  }
                }
              ]
            }
          },
          {
            "name": "sort",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "createdAt"
            }
          },
          {
            "name": "sortOrder",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ]
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "integer",
                            "example": 123456
                          },
                          "code": {
                            "type": "string",
                            "example": "IT2506100001"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "pre_order",
                              "pre_payment",
                              "pre_book",
                              "finish",
                              "canceled"
                            ]
                          },
                          "paymentStatus": {
                            "type": "string",
                            "enum": [
                              "yes",
                              "no",
                              "partial"
                            ]
                          },
                          "currency": {
                            "type": "string",
                            "example": "EUR"
                          },
                          "tourBegin": {
                            "type": "string",
                            "format": "date"
                          },
                          "tourEnd": {
                            "type": "string",
                            "format": "date"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "title": {
                            "type": "string",
                            "description": "Display name; falls back to `code` if absent."
                          },
                          "destination": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "integer"
                              },
                              "code": {
                                "type": "string",
                                "example": "JP"
                              },
                              "name": {
                                "type": "string",
                                "example": "Japan"
                              }
                            }
                          },
                          "agencyId": {
                            "type": "integer",
                            "nullable": true
                          },
                          "totals": {
                            "type": "object",
                            "properties": {
                              "net": {
                                "type": "number"
                              },
                              "gross": {
                                "type": "number"
                              },
                              "paid": {
                                "type": "number"
                              }
                            }
                          },
                          "tourists": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "firstNameEn": {
                                  "type": "string"
                                },
                                "lastNameEn": {
                                  "type": "string"
                                }
                              }
                            }
                          },
                          "services": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "integer"
                                },
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "hotel",
                                    "fly",
                                    "train",
                                    "transfer",
                                    "railway",
                                    "bus"
                                  ]
                                },
                                "title": {
                                  "type": "string"
                                },
                                "entityNumber": {
                                  "type": "string",
                                  "description": "Carrier-assigned number (e.g. flight number, PNR)."
                                }
                              }
                            }
                          },
                          "holdExpiresAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time",
                            "description": "Earliest supplier time limit of a held, not yet ticketed flight or train booking; past it the order cannot be issued. Not returned for hotel-only orders."
                          },
                          "ticketingDeadline": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "The order's payment deadline (`payBefore`). Not returned for hotel-only orders."
                          }
                        }
                      }
                    },
                    "total": {
                      "type": "integer",
                      "example": 142
                    },
                    "offset": {
                      "type": "integer",
                      "example": 0
                    },
                    "limit": {
                      "type": "integer",
                      "example": 20
                    }
                  }
                },
                "example": {
                  "items": [
                    {
                      "id": 123456,
                      "code": "IT2506100001",
                      "status": "pre_book",
                      "paymentStatus": "no",
                      "currency": "EUR",
                      "tourBegin": "2026-06-10",
                      "tourEnd": "2026-06-17",
                      "createdAt": "2026-05-25T14:00:00Z",
                      "title": "Tokyo customer visits",
                      "destination": {
                        "id": 78,
                        "code": "JP",
                        "name": "Japan"
                      },
                      "agencyId": 45,
                      "totals": {
                        "net": 4280.5,
                        "gross": 4360.0,
                        "paid": 0
                      },
                      "tourists": [
                        {
                          "firstNameEn": "JOHN",
                          "lastNameEn": "DOE"
                        }
                      ],
                      "services": [
                        {
                          "id": 78901,
                          "type": "hotel",
                          "title": "Park Hyatt Tokyo"
                        },
                        {
                          "id": 78902,
                          "type": "fly",
                          "entityNumber": "SU1234"
                        }
                      ]
                    }
                  ],
                  "total": 142,
                  "offset": 0,
                  "limit": 20
                }
              }
            }
          }
        },
        "description": "List orders matching the given filters. Pagination via `offset`/`limit`. Response is wrapped as `{items, total, offset, limit}` for easy client handling."
      }
    },
    "/v1/orders/{id}": {
      "get": {
        "tags": [
          "Orders"
        ],
        "summary": "Get one order",
        "description": "Full order including services, passengers, payments, and (when applicable) rewards/loyalty annotations.\n\n**Price breakdown.** `order.priceBreakdown` = `{currency, services, serviceFees, financialGuarantee, total}`; each `services[].priceBreakdown` = `{currency, baseFare, taxes: {total, itemized, lines[{code, title, amount, currency}]}, carrierFees, serviceFee, agentMarkup?, total}` with the supplier's tax lines when it itemised them. Not returned to widget-token callers.\n\n**Hold and ticketing deadline.** For orders with flights or trains the order carries `holdExpiresAt` (ISO 8601) — the earliest time limit the supplier set on a held booking that is not ticketed yet; `null` when no held booking has one. Past it the booking can no longer be issued or paid: issuing and payment are refused and the booking has to be made again. The limit is the airline's (from minutes for low-cost carriers to days on full-service ones). `ticketingDeadline` is the order's payment deadline (`payBefore`). Neither is returned for hotel-only orders.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/orders/{id}/cancel/check": {
      "get": {
        "tags": [
          "Orders"
        ],
        "summary": "Cancel preview (penalty)",
        "description": "Returns whether the order can be cancelled and an estimate of the refund and the penalty, without acting. Always call before showing a confirmation prompt: the estimate may involve a live supplier query.\n\n**How the estimate is made**, per active service of the order, summed in the order currency:\n- hotels — from the stored cancellation policy of the rate;\n- trains, Sirena and Kyte flights — a live refund quote from the supplier;\n- other flights (e.g. Amadeus) — free inside the airline's void window, otherwise the full price as penalty until the airline confirms the refund at cancellation;\n- anything that cannot be quoted — the full price as penalty.\n\nThe refund never exceeds what was paid on the order. When part of the estimate is not a supplier quote, `rules` says so; the final amounts are set at cancellation. Not cancellable (`cancellable: false`, no `refund`): the order is already cancelled or pending cancellation, or has no active services — `rules` says which.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "cancellable": {
                      "type": "boolean"
                    },
                    "refund": {
                      "type": "object",
                      "description": "Only when `cancellable` is true.",
                      "properties": {
                        "estimatedAmount": {
                          "type": "number",
                          "description": "What would come back to the client, in `currency`."
                        },
                        "penalty": {
                          "type": "number",
                          "description": "What would be kept, in `currency`."
                        },
                        "currency": {
                          "type": "string",
                          "description": "Order currency, ISO-3."
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "full",
                            "partial",
                            "none"
                          ],
                          "description": "`full` — no penalty; `partial` — a penalty and a refund; `none` — nothing comes back."
                        }
                      }
                    },
                    "deadline": {
                      "type": "string",
                      "description": "The order's payment deadline (`payBefore`) when set. Not a free-cancellation deadline."
                    },
                    "rules": {
                      "type": "string",
                      "description": "Plain-English note: how the estimate was made, or why the order cannot be cancelled."
                    }
                  }
                },
                "examples": {
                  "cancellable": {
                    "value": {
                      "cancellable": true,
                      "refund": {
                        "estimatedAmount": 180.2,
                        "penalty": 32.25,
                        "currency": "GBP",
                        "type": "partial"
                      },
                      "deadline": "2026-06-09 11:00:00",
                      "rules": "Estimated from current supplier cancellation rules"
                    }
                  },
                  "estimate": {
                    "value": {
                      "cancellable": true,
                      "refund": {
                        "estimatedAmount": 0,
                        "penalty": 412.0,
                        "currency": "EUR",
                        "type": "none"
                      },
                      "rules": "Estimate; the final penalty for some services is confirmed at cancellation"
                    }
                  },
                  "notCancellable": {
                    "value": {
                      "cancellable": false,
                      "rules": "Order is already pending cancellation"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/orders/{id}/cancel": {
      "post": {
        "tags": [
          "Orders"
        ],
        "summary": "Cancel order",
        "description": "Asks for cancellation. The answer carries `status: pending_cancellation`; the supplier cancel and the refund run in a queue — poll `GET /v1/orders/{id}` until the order is `canceled`. Check the penalty first with `GET /v1/orders/{id}/cancel/check`. Refunds go to the original payment method (or the deposit balance for non-card flows).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "description": "Free text — surfaced in audit trail."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK (updated order)"
          }
        }
      }
    },
    "/v1/orders/{id}/modify/check": {
      "get": {
        "tags": [
          "Orders"
        ],
        "summary": "Modify preview",
        "description": "Validates whether a specific change is allowed and quotes cost.\n\n**Types:**\n- `contact` — passenger email/phone (free)\n- `passport` — document number / expiry (carrier-dependent fee)\n- `rebook` — change date/route (quotes fare difference)\n- `baggage` — add allowance (carrier-dependent)",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "contact",
                "passport",
                "rebook",
                "baggage"
              ]
            }
          },
          {
            "name": "serviceId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/orders/{id}/modify": {
      "post": {
        "tags": [
          "Orders"
        ],
        "summary": "Apply modification",
        "description": "Returns updated order. For `rebook` response also includes new fare and debt/credit applied.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "type",
                  "changes"
                ],
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "contact",
                      "passport",
                      "rebook",
                      "baggage"
                    ]
                  },
                  "changes": {
                    "type": "object",
                    "description": "Type-specific payload. Always includes `serviceId`."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/wallet": {
      "get": {
        "tags": [
          "Wallet"
        ],
        "summary": "Current balance per currency",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/wallet/transactions": {
      "get": {
        "tags": [
          "Wallet"
        ],
        "summary": "Transaction history (paginated)",
        "description": "Top-ups, charges, refunds.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/wallet/top-up/bill": {
      "post": {
        "tags": [
          "Wallet"
        ],
        "summary": "Issue an invoice for bank transfer",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/wallet/top-up/card": {
      "post": {
        "tags": [
          "Wallet"
        ],
        "summary": "Charge a saved card to top up",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/wallet/top-up/crypto": {
      "post": {
        "tags": [
          "Wallet"
        ],
        "summary": "Generate crypto payment address",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/wallet/top-up/reverse": {
      "post": {
        "tags": [
          "Wallet"
        ],
        "summary": "Reverse a deposit top-up (accounting only)",
        "description": "Undoes a deposit top-up: a duplicate credit, a wrong depositor, a payment that turned out not to have arrived. A reversing entry is written and the original credit is never deleted - the journal is the register reports and reconciliations are built from, so both entries stay visible in the wallet history. Idempotent on the credit being undone: a repeat answers duplicate=true and debits nothing. Refuses with 409 when the balance is already lower than the amount to reverse (that money has been spent); taking a wallet negative is an accounting decision, not an API one. Access is limited to ADMIN_ACCOUNTANT / ADMIN / DEVELOPER with no generic admin bypass, plus API tokens for the accounting system - this cancels somebody else's credit, so it is deliberately not a wallet-owner action.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "paymentId": {
                    "type": "string",
                    "description": "The paymentId sent when the top-up was credited. One of paymentId / transactionId is required."
                  },
                  "transactionId": {
                    "type": "integer",
                    "description": "Journal row id of the credit, when the caller kept it instead."
                  },
                  "amount": {
                    "type": "number",
                    "description": "When given, must match the original credit to the cent - otherwise 409."
                  },
                  "description": {
                    "type": "string",
                    "description": "Reason; appended to the reversal entry title."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Reversed, or already reversed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "depositorId": {
                      "type": "integer"
                    },
                    "transactionId": {
                      "type": "integer",
                      "description": "The credit that was undone."
                    },
                    "reversalId": {
                      "type": "integer",
                      "description": "The reversing entry."
                    },
                    "reversed": {
                      "type": "number"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "balanceAfter": {
                      "type": "number"
                    },
                    "duplicate": {
                      "type": "boolean",
                      "description": "true when the credit had already been reversed - nothing was debited."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Neither paymentId nor transactionId given"
          },
          "403": {
            "description": "Role not allowed to reverse deposits"
          },
          "404": {
            "description": "No such top-up"
          },
          "409": {
            "description": "amount disagrees with the original credit, or the balance is lower than the amount to reverse (shortfall returned)"
          }
        }
      }
    },
    "/v1/wallet/notification": {
      "put": {
        "tags": [
          "Wallet"
        ],
        "summary": "Configure low-balance alerts",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/deposits/balance": {
      "get": {
        "tags": [
          "Deposits"
        ],
        "summary": "Deposit balance of a given depositor",
        "description": "Current deposit balance of the company identified by `depositorId` or by tax id (`unp`), for reconciliation before booking a payment or rolling one back.\n\nThe balance is kept in the depositor's national currency, per legal entity — `agencyId` says which entity's wallet was read. Money is not shared between entities of the same account.\n\nAccounting roles only.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "depositorId",
            "in": "query",
            "description": "Travel Code account id of the depositor. Either this or `unp` is required; takes precedence when both are given.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "unp",
            "in": "query",
            "description": "Payer tax id (UNP / INN). Rejected with 409 when several companies share it — pass `depositorId` instead.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "depositorId": {
                      "type": "integer",
                      "example": 7094
                    },
                    "balance": {
                      "type": "number",
                      "example": 18317.46
                    },
                    "currency": {
                      "type": "string",
                      "example": "BYN"
                    },
                    "agencyId": {
                      "type": "integer",
                      "example": 1747
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Caller is not an accounting user"
          },
          "404": {
            "description": "Depositor not found"
          },
          "409": {
            "description": "Several companies match this tax id (error code 122)"
          }
        }
      }
    },
    "/v1/deposits/top-up": {
      "post": {
        "tags": [
          "Deposits"
        ],
        "summary": "Book a bank payment onto a depositor's deposit",
        "description": "Credits money that arrived at the bank to a company's deposit balance — the bookkeeping counterpart of the client-facing Wallet top-ups.\n\n**Send `paymentId`.** It makes the call idempotent (a retry returns `duplicate: true` and credits nothing) and it is what a later reversal is found by; without it a repeated call credits twice.\n\nThe balance lives in the depositor's national currency. Paying in another currency requires `rate` — national units per 1 unit of the paid currency — otherwise the call is rejected rather than guessing a rate.\n\nAccounting roles only. To undo a credit use `POST /v1/wallet/top-up/reverse`.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "amount",
                  "currency"
                ],
                "properties": {
                  "depositorId": {
                    "type": "integer",
                    "description": "Travel Code account id of the depositor. Either this or `unp` is required.",
                    "example": 7094
                  },
                  "unp": {
                    "type": "string",
                    "description": "Payer tax id (UNP / INN), used when the depositor id is unknown.",
                    "example": "193534138"
                  },
                  "amount": {
                    "type": "number",
                    "description": "Amount actually paid, in `currency`.",
                    "example": 45000
                  },
                  "currency": {
                    "type": "string",
                    "description": "Currency of the payment.",
                    "example": "BYN"
                  },
                  "rate": {
                    "type": "number",
                    "description": "Required only when `currency` differs from the balance currency: national units per 1 unit of `currency`.",
                    "example": 3.28
                  },
                  "paymentId": {
                    "type": "string",
                    "description": "Your own id of the bank payment. Idempotency key, and the handle a reversal uses.",
                    "example": "DEP202608067094"
                  },
                  "paymentDate": {
                    "type": "string",
                    "description": "Value date of the payment (Y-m-d). Defaults to now.",
                    "example": "2026-08-06"
                  },
                  "account": {
                    "type": "string",
                    "description": "Bank account the money arrived on."
                  },
                  "description": {
                    "type": "string",
                    "description": "Free-text note stored as the transaction title."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "depositorId": {
                      "type": "integer",
                      "example": 7094
                    },
                    "credited": {
                      "type": "number",
                      "description": "Amount added to the balance, in the balance currency.",
                      "example": 45000
                    },
                    "currency": {
                      "type": "string",
                      "example": "BYN"
                    },
                    "balanceAfter": {
                      "type": "number",
                      "example": 63317.46
                    },
                    "transactionId": {
                      "type": "integer",
                      "example": 6835
                    },
                    "duplicate": {
                      "type": "boolean",
                      "description": "true when this `paymentId` was already credited — nothing was added.",
                      "example": false
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "amount / currency missing or not positive"
          },
          "403": {
            "description": "Caller is not an accounting user"
          },
          "404": {
            "description": "Depositor not found"
          },
          "409": {
            "description": "Ambiguous tax id (122), depositor has no balance currency (124), or a foreign currency without `rate` (123 — the error text carries the balance currency)"
          }
        }
      }
    },
    "/v1/accounting/sync": {
      "get": {
        "tags": [
          "Accounting Sync"
        ],
        "summary": "Sync with external accounting software",
        "description": "Generic gateway for syncing data between Travel Code and external accounting systems. A single endpoint exposes many operations — the `action` parameter selects which one. Additional query parameters depend on the chosen action.\n\n## Typical use cases\n\n- **Push** new orders, payments, refunds, and tourist records to an accounting system right after booking confirmation.\n- **Pull** invoice numbers, posting IDs, and reconciliation status back into Travel Code.\n- **Sync** reference data (counterparties, currencies, services catalogue) on a schedule.\n- **Trigger** scheduled reports / period closings remotely.\n\n## Content negotiation\n\nSome accounting backends require XML. Pass `Accept: application/xml` to get XML back; default is `application/json`.\n\n## Authentication\n\nBearer token (JWT) tied to an account that has the accounting integration enabled. Per-action permissions are enforced server-side.\n\n## Supported systems & custom integrations\n\nThe current catalogue of supported accounting systems is maintained at [travel-code.com/integrations](https://travel-code.com/integrations). **Need a new accounting system, a new action, or a different data shape? Account manager can scope a custom adapter** — the gateway is built so new integrations slot in without breaking existing ones.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "action",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "examples": [
                "push_order",
                "push_payment",
                "push_refund",
                "pull_invoice",
                "pull_posting_status",
                "sync_counterparties",
                "sync_services_catalogue",
                "sync_currency_rates",
                "trigger_period_close",
                "trigger_report"
              ]
            },
            "description": "Operation name. Examples below are typical — the actual catalogue depends on the accounting system integrated for your account. Ask account manager for the complete list and per-action parameter spec."
          },
          {
            "name": "orderId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Travel Code order id. Required by order/payment/refund push actions."
          },
          {
            "name": "code",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "example": "GB260611005"
            },
            "description": "Travel Code order code. Alternative key to `orderId`."
          },
          {
            "name": "dateFrom",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Date window — lower bound. Used by pull/sync/report actions."
          },
          {
            "name": "dateTo",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Date window — upper bound."
          },
          {
            "name": "currency",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "example": "USD"
            },
            "description": "ISO currency override where applicable."
          }
        ],
        "responses": {
          "200": {
            "description": "Operation completed. Shape depends on `action` and `Accept` header.",
            "content": {
              "application/json": {
                "examples": {
                  "push-order": {
                    "summary": "After push_order",
                    "value": {
                      "status": "ok",
                      "action": "push_order",
                      "externalId": "INV-2026-00012345",
                      "syncedAt": "2026-06-11T08:42:00+00:00"
                    }
                  },
                  "pull-invoice": {
                    "summary": "After pull_invoice",
                    "value": {
                      "status": "ok",
                      "action": "pull_invoice",
                      "orderCode": "GB260611005",
                      "invoiceNumber": "INV-2026-00012345",
                      "invoiceDate": "2026-06-11",
                      "postingStatus": "posted",
                      "amount": 412.45,
                      "currency": "GBP"
                    }
                  },
                  "sync-batch": {
                    "summary": "After sync_currency_rates (batch result)",
                    "value": {
                      "status": "ok",
                      "action": "sync_currency_rates",
                      "processed": 142,
                      "skipped": 0,
                      "errors": 0,
                      "runId": "run_8c2f1e"
                    }
                  }
                }
              },
              "application/xml": {
                "schema": {
                  "type": "string",
                  "description": "XML envelope mirroring the JSON shape — used when target system requires XML."
                }
              }
            }
          },
          "400": {
            "description": "Unknown `action`, unsupported target system, or missing action-specific parameter.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "example": "UNSUPPORTED_ACTION"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": [
                            "object",
                            "null"
                          ]
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Token missing or accounting integration not enabled for this account."
          },
          "502": {
            "description": "Upstream accounting system unreachable or returned an error."
          }
        }
      }
    },
    "/v1/orders/{id}/payments": {
      "post": {
        "tags": [
          "Orders"
        ],
        "summary": "Register a payment against an order",
        "description": "Records an income or outcome bill against an order and runs payment processing.\n\n**Dedup:** income types by `paymentId + paymentDate + order`; outcome by `orderId + serviceId + partnerId + price + currency`. A duplicate → 409.\n\n**Scope:** trusted-integration — requires a staff/back-office role (403 otherwise).\n\n**Replaces legacy:** `POST /order/bill`.",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Travel Code order id."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "price",
                  "description"
                ],
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "income",
                      "income_cashbox_card",
                      "income_cashbox_cash",
                      "outcome"
                    ],
                    "description": "Defaults to income."
                  },
                  "price": {
                    "type": "number",
                    "description": "Amount (positive)."
                  },
                  "currency": {
                    "type": "string",
                    "description": "ISO-3. Defaults to the order currency, then BYN."
                  },
                  "description": {
                    "type": "string",
                    "description": "Required. Free-text label."
                  },
                  "paymentId": {
                    "type": "string",
                    "description": "Required for income* types. Dedup key."
                  },
                  "paymentDate": {
                    "type": "string",
                    "description": "Required for income* types (date). Dedup key."
                  },
                  "serviceId": {
                    "type": "integer",
                    "description": "For outcome dedup."
                  },
                  "partnerId": {
                    "type": "integer",
                    "description": "For outcome dedup."
                  },
                  "recalcNet": {
                    "type": "boolean",
                    "default": true,
                    "description": "Only for `outcome` bills pinned to a `serviceId`. When true (default), aligns the service's planned netto to the just-paid partner amount by the netto rule: ordinary avia → planned netto = cost = partner payment; fintech / separate-responsible avia / special railway → cost only, planned netto kept. Send false to leave the planned netto untouched."
                  }
                },
                "example": {
                  "type": "income",
                  "price": 950.0,
                  "currency": "EUR",
                  "description": "Card charge",
                  "paymentId": "pi_3OqA8Y",
                  "paymentDate": "2026-05-25"
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Payment registered.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "OK"
                    },
                    "orderId": {
                      "type": "integer"
                    },
                    "billId": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ErrorEnvelope"
          },
          "404": {
            "description": "Order not found."
          },
          "409": {
            "description": "Duplicate payment (same dedup key)."
          }
        }
      }
    },
    "/v1/orders/{id}/files": {
      "post": {
        "tags": [
          "Orders"
        ],
        "summary": "Upload files to an order",
        "description": "Attach one or more files to an order as order documents. Unified multipart upload.\n\n**Limits:** per-file 20 MB; allowed extensions: pdf, jpg, jpeg, png, gif, webp, doc, docx, xls, xlsx, txt.\n\n**Scope:** trusted-integration — requires a staff/back-office role (403 otherwise).\n\n**Replaces legacy:** `POST /order/upload-files`, `/order/upload-tickets`, `/order/upload-insurance`.",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Travel Code order id."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "files[]",
                  "type"
                ],
                "properties": {
                  "files[]": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "binary"
                    },
                    "description": "One or more files. A single `file` field is also accepted."
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "tour",
                      "air",
                      "account",
                      "transfer",
                      "agreement",
                      "hotelWishes",
                      "train",
                      "insurance",
                      "hotelVoucher"
                    ],
                    "description": "Document category."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Files attached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "orderId": {
                      "type": "integer"
                    },
                    "type": {
                      "type": "string"
                    },
                    "files": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "integer"
                          },
                          "fileName": {
                            "type": "string"
                          },
                          "fileUrl": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "No files, unsupported extension, file > 20 MB, or bad type."
          },
          "404": {
            "description": "Order not found."
          }
        }
      }
    },
    "/v1/risk-alerts/active": {
      "get": {
        "tags": [
          "Risk Alerts"
        ],
        "summary": "Active alerts",
        "description": "All active risk events worldwide. Pagination is handled server-side; the full dataset is returned in one response. Cached for 5 minutes.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/RiskAlert"
                      }
                    },
                    "fetched_at": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/risk-alerts/by-country": {
      "get": {
        "tags": [
          "Risk Alerts"
        ],
        "summary": "Active alerts by country",
        "description": "Same dataset as `/active`, grouped by ISO 3166-1 alpha-3 country code. Useful for map rendering — single round-trip instead of N per-country calls. Built from the same server cache.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "description": "Keys are ISO 3166-1 alpha-3 country codes.",
                      "additionalProperties": {
                        "type": "array",
                        "items": {
                          "$ref": "#/components/schemas/RiskAlert"
                        }
                      },
                      "example": {
                        "TUR": [],
                        "UKR": []
                      }
                    },
                    "fetched_at": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/risk-alerts/country/{iso}": {
      "get": {
        "tags": [
          "Risk Alerts"
        ],
        "summary": "Country advisory",
        "description": "Advisory record for a single country. Returns `data: null` (HTTP 200) for countries with no active record — avoids 404 noise when probing many ISO codes.",
        "parameters": [
          {
            "name": "iso",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "DEU"
            },
            "description": "ISO 3166-1 alpha-3 country code."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/TravelRiskCountry"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "fetched_at": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/risk-alerts/risk-score/{iso}": {
      "get": {
        "tags": [
          "Risk Alerts"
        ],
        "summary": "Country risk score",
        "description": "Composite risk score for a single country. Returns `data: null` for countries without a risk score record. Cached for 1 hour.",
        "parameters": [
          {
            "name": "iso",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "DEU"
            },
            "description": "ISO 3166-1 alpha-3 country code."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/TravelRiskScore"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "fetched_at": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/risk-alerts/conflicts": {
      "get": {
        "tags": [
          "Risk Alerts"
        ],
        "summary": "Armed-conflict events",
        "description": "GDELT-sourced armed-conflict events. Without `country`/`skip` filters the proxy auto-paginates and returns the full dataset (capped at 8 000 events). Cached for 5 minutes per unique filter combination.",
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 30
            },
            "description": "Limit to events in the last N days."
          },
          {
            "name": "country",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "UKR"
            },
            "description": "ISO 3166-1 alpha-3 filter."
          },
          {
            "name": "min_severity",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "Low",
                "Medium",
                "High",
                "Critical"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 100
            }
          },
          {
            "name": "skip",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ConflictEvent"
                      }
                    },
                    "total": {
                      "type": "integer"
                    },
                    "filters": {
                      "$ref": "#/components/schemas/ConflictFilters"
                    },
                    "attribution": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      }
                    },
                    "fetched_at": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/risk-alerts/advisories": {
      "get": {
        "tags": [
          "Risk Alerts"
        ],
        "summary": "Government travel advisories",
        "description": "Travel advisories aggregated from the US State Department, UK FCDO, and Canada GAC. Cached for 1 hour.",
        "parameters": [
          {
            "name": "country",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "IRN"
            },
            "description": "ISO 3166-1 alpha-3 — filter to a single country."
          },
          {
            "name": "min_level",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 4
            },
            "description": "Minimum advisory level. 1=Normal Caution, 2=Increased Caution, 3=Reconsider Travel, 4=Do Not Travel."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/CountryAdvisory"
                      }
                    },
                    "total": {
                      "type": "integer"
                    },
                    "attribution": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      }
                    },
                    "fetched_at": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/travelers": {
      "get": {
        "tags": [
          "Travelers"
        ],
        "summary": "List travelers",
        "description": "Returns your company's trip participants with current location and trip dates. Use `active=true` to see only travelers currently on a trip.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "active",
            "in": "query",
            "schema": {
              "type": "boolean"
            },
            "description": "If `true`, return only travelers with an active trip right now."
          },
          {
            "name": "trip_from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date",
              "example": "2026-05-01"
            },
            "description": "Filter: trip starts on or after this date."
          },
          {
            "name": "trip_to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date",
              "example": "2026-05-31"
            },
            "description": "Filter: trip ends on or before this date."
          },
          {
            "name": "country_iso",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "DEU"
            },
            "description": "ISO 3166-1 alpha-3 — travelers currently in this country."
          },
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 2
            },
            "description": "Search by name or email (min 2 characters)."
          },
          {
            "name": "order_status",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "active,confirmed"
            },
            "description": "Comma-separated order statuses to include."
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 2000,
              "default": 100
            }
          },
          {
            "name": "sort",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "trip_start",
                "trip_end",
                "name"
              ],
              "default": "trip_start"
            }
          },
          {
            "name": "sort_order",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ],
              "default": "asc"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Traveler"
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "offset": {
                          "type": "integer"
                        },
                        "limit": {
                          "type": "integer"
                        },
                        "total": {
                          "type": "integer"
                        }
                      }
                    },
                    "fetched_at": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/travelers/{id}": {
      "get": {
        "tags": [
          "Travelers"
        ],
        "summary": "Get traveler",
        "description": "Full traveler profile including passport data, nationality, and current trip services (flights, hotels, transfers). Returns 404 if the traveler is not accessible under your account.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "oc-123"
            },
            "description": "Traveler ID from `list_travelers`."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/TravelerDetails"
                    },
                    "fetched_at": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Traveler not found or not accessible under your account."
          }
        }
      }
    },
    "/v1/travelers/contact": {
      "post": {
        "tags": [
          "Travelers"
        ],
        "summary": "Contact travelers",
        "description": "Send a safety check-in, evacuation advisory, or custom message to one or more travelers via email, SMS, or push notification. Travelers not accessible under your account are returned in `failed` with reason `not_accessible` — the rest are still processed.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContactTravelersRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactTravelersResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orders/import": {
      "post": {
        "tags": [
          "Orders"
        ],
        "summary": "Import order from external booking",
        "description": "Create a Travel Code order from a booking confirmed elsewhere (browser-extension capture, forwarded email, manual entry). No provider booking call is made — prices and identifiers are stored as supplied. Unlike `POST /v1/orders`, no sessionId/offerId is needed.\n\n**Idempotency:** `Idempotency-Key` header, 24h window. Same key + same body returns the existing order; same key + different body → 409.\n\n**Replaces legacy:** `POST /order/import`.",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Optional UUID, 24h window."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "tourBegin",
                  "tourEnd",
                  "countryId",
                  "currency",
                  "tourists",
                  "services"
                ],
                "properties": {
                  "source": {
                    "type": "string",
                    "enum": [
                      "robert-ext",
                      "email-forward",
                      "manual"
                    ],
                    "description": "Defaults to manual."
                  },
                  "brand": {
                    "type": "string",
                    "enum": [
                      "travelhub",
                      "travelcode"
                    ],
                    "description": "Sets order URL host. Defaults to the API user's brand."
                  },
                  "tourBegin": {
                    "type": "string",
                    "format": "date"
                  },
                  "tourEnd": {
                    "type": "string",
                    "format": "date"
                  },
                  "countryId": {
                    "description": "Country id (int) or ISO-2 code (string).",
                    "oneOf": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "string"
                      }
                    ]
                  },
                  "currency": {
                    "type": "string",
                    "description": "ISO-3."
                  },
                  "paymentMethod": {
                    "type": "string",
                    "description": "Defaults to external (already paid)."
                  },
                  "tourists": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "object",
                      "properties": {
                        "firstNameEn": {
                          "type": "string"
                        },
                        "lastNameEn": {
                          "type": "string"
                        },
                        "gender": {
                          "type": "string",
                          "enum": [
                            "M",
                            "F"
                          ]
                        },
                        "birthDate": {
                          "type": "string",
                          "format": "date"
                        },
                        "nationality": {
                          "type": "string",
                          "description": "ISO-2."
                        },
                        "documentNumber": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "firstNameEn",
                        "lastNameEn"
                      ]
                    }
                  },
                  "services": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "object",
                      "description": "One service. For hotel, you MAY resolve the canonical Hotel id via `/v1/data/hotel-locations?q=...&onlyNames=1` (or `/v1/search/hotels/search-names` from a cached search) and pass it as `entityId` — repeated imports of the same hotel will then link to one row for analytics. Empty `entityId` is fine: the card falls back to `params.model.*`. Fly has no canonical entity — segments go to `params.model.itineraries`.",
                      "required": [
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "hotel",
                            "fly",
                            "transfer",
                            "railway",
                            "bus",
                            "excursion",
                            "experience"
                          ]
                        },
                        "priceNet": {
                          "type": "number"
                        },
                        "priceGross": {
                          "type": "number",
                          "description": "Defaults to priceNet."
                        },
                        "peopleCount": {
                          "type": "integer"
                        },
                        "partnerId": {
                          "type": "integer"
                        },
                        "date": {
                          "type": "string",
                          "format": "date"
                        },
                        "title": {
                          "type": "string",
                          "description": "Ignored for railway/bus (auto-generated from segments)."
                        },
                        "tourists": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "firstNameEn": {
                                "type": "string"
                              },
                              "lastNameEn": {
                                "type": "string"
                              },
                              "gender": {
                                "type": "string",
                                "enum": [
                                  "M",
                                  "F"
                                ]
                              },
                              "birthDate": {
                                "type": "string",
                                "format": "date"
                              },
                              "nationality": {
                                "type": "string",
                                "description": "ISO-2."
                              },
                              "documentNumber": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "firstNameEn",
                              "lastNameEn"
                            ]
                          },
                          "description": "Optional subset; omit to link all top-level tourists."
                        },
                        "hotelName": {
                          "type": "string",
                          "description": "Hotel display name. Required for type=hotel."
                        },
                        "stars": {
                          "type": "integer"
                        },
                        "address": {
                          "type": "string",
                          "description": "Hotel address. Required for type=hotel."
                        },
                        "phone": {
                          "type": "string"
                        },
                        "board": {
                          "type": "string",
                          "description": "Meal plan (BB / HB / RO / etc.)."
                        },
                        "roomName": {
                          "type": "string"
                        },
                        "refundPolicy": {
                          "type": "string"
                        },
                        "pnr": {
                          "type": "string",
                          "description": "PNR / itinerary id. Stored under `params.bookingInfo.itineraryId`."
                        },
                        "airline": {
                          "type": "string"
                        },
                        "seat": {
                          "type": "string"
                        },
                        "fareClass": {
                          "type": "string"
                        },
                        "luggage": {
                          "type": "string"
                        },
                        "segments": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "description": "Required fields apply to type=fly. Railway/bus use a different set.",
                            "required": [
                              "carrier",
                              "flightNumber",
                              "departureAt",
                              "arrivalAt",
                              "duration"
                            ],
                            "properties": {
                              "carrier": {
                                "type": "string",
                                "description": "IATA carrier code (2 letters). Required for type=fly. `carrierCode` accepted as alias.",
                                "example": "LH"
                              },
                              "carrierCode": {
                                "type": "string",
                                "description": "Alias for `carrier`."
                              },
                              "flightNumber": {
                                "type": "string",
                                "description": "Flight number digits (without carrier prefix). Required for type=fly. `number` accepted as alias.",
                                "example": "1485"
                              },
                              "number": {
                                "type": "string",
                                "description": "Alias for `flightNumber`."
                              },
                              "departureAt": {
                                "type": "string",
                                "format": "date-time",
                                "description": "ISO 8601 local departure timestamp. Required for type=fly. `timeFrom` accepted as alias.",
                                "example": "2026-06-15T08:35:00"
                              },
                              "timeFrom": {
                                "type": "string",
                                "description": "Alias for `departureAt`."
                              },
                              "arrivalAt": {
                                "type": "string",
                                "format": "date-time",
                                "description": "ISO 8601 local arrival timestamp. Required for type=fly. `timeTo` accepted as alias."
                              },
                              "timeTo": {
                                "type": "string",
                                "description": "Alias for `arrivalAt`."
                              },
                              "duration": {
                                "type": "string",
                                "description": "Flight duration as 'HH:MM'. Required for type=fly.",
                                "example": "02:15"
                              },
                              "from": {
                                "type": "string",
                                "description": "Departure IATA code.",
                                "example": "FRA"
                              },
                              "fromIata": {
                                "type": "string",
                                "description": "Alias for `from`."
                              },
                              "to": {
                                "type": "string",
                                "description": "Arrival IATA code.",
                                "example": "JFK"
                              },
                              "toIata": {
                                "type": "string",
                                "description": "Alias for `to`."
                              },
                              "fromCity": {
                                "type": "string"
                              },
                              "fromAirport": {
                                "type": "string"
                              },
                              "toCity": {
                                "type": "string"
                              },
                              "toAirport": {
                                "type": "string"
                              },
                              "countryFrom": {
                                "type": "integer",
                                "description": "Country id (railway/bus only)."
                              },
                              "countryTo": {
                                "type": "integer",
                                "description": "Country id (railway/bus only)."
                              },
                              "stationFrom": {
                                "type": "string",
                                "description": "Station name (railway/bus only)."
                              },
                              "stationTo": {
                                "type": "string",
                                "description": "Station name (railway/bus only)."
                              },
                              "seatType": {
                                "type": "string",
                                "description": "Railway seat type (railway only)."
                              }
                            }
                          },
                          "description": "fly/railway/bus segments. For type=fly each item must include carrier, flightNumber, departureAt, arrivalAt, duration."
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "new",
                            "preBook",
                            "prePayment",
                            "finish",
                            "awaitingCancellation",
                            "canceled",
                            "refused"
                          ],
                          "description": "Service status. Defaults to 'new'. Use 'prePayment' / 'finish' to mark already-paid or already-confirmed bookings."
                        },
                        "entityId": {
                          "type": "integer",
                          "description": "Hotel id from `/v1/data/hotel-locations` (or `/v1/search/hotels/search-names`). Optional; only honoured for type=hotel. Unknown id → 400."
                        },
                        "dayDuration": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Nights for hotel / duration in days for transfer/excursion. Required for type=hotel."
                        },
                        "dayCount": {
                          "type": "integer",
                          "description": "Day index inside the trip (1-based). Defaults to 1."
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created (order envelope, same shape as GET /v1/orders/{id}). Envelope `order` contains `viewUrl` (brand-aware, https://<order's brand domain>/orders/view/{id}) and `brand` (the order's source enum, e.g. 'travelcode' / 'travelhub')."
          },
          "400": {
            "$ref": "#/components/responses/ErrorEnvelope"
          },
          "409": {
            "description": "Idempotency-Key reused with a different body."
          }
        }
      }
    },
    "/v1/orders/{id}/services": {
      "post": {
        "tags": [
          "Orders"
        ],
        "summary": "Append services to an existing order",
        "description": "Add one or more services to an order. Same per-service shape as `POST /v1/orders/import`. No provider booking. Per-service `tourists[]` are matched against existing travellers by firstNameEn+lastNameEn (case-insensitive) and reused, or created.\n\n**Replaces legacy:** `POST /order/add-services`.",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Travel Code order id."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "services"
                ],
                "properties": {
                  "services": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "object",
                      "description": "One service. For hotel/fly put rich data in typed fields (stored under params.model.*); do NOT send entityId/roomId/mealId/airServiceId.",
                      "required": [
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "hotel",
                            "fly",
                            "transfer",
                            "railway",
                            "bus",
                            "excursion",
                            "experience"
                          ]
                        },
                        "priceNet": {
                          "type": "number"
                        },
                        "priceGross": {
                          "type": "number",
                          "description": "Defaults to priceNet."
                        },
                        "peopleCount": {
                          "type": "integer"
                        },
                        "partnerId": {
                          "type": "integer"
                        },
                        "date": {
                          "type": "string",
                          "format": "date"
                        },
                        "title": {
                          "type": "string",
                          "description": "Ignored for railway/bus (auto-generated from segments)."
                        },
                        "tourists": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "firstNameEn": {
                                "type": "string"
                              },
                              "lastNameEn": {
                                "type": "string"
                              },
                              "gender": {
                                "type": "string",
                                "enum": [
                                  "M",
                                  "F"
                                ]
                              },
                              "birthDate": {
                                "type": "string",
                                "format": "date"
                              },
                              "nationality": {
                                "type": "string",
                                "description": "ISO-2."
                              },
                              "documentNumber": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "firstNameEn",
                              "lastNameEn"
                            ]
                          },
                          "description": "Optional subset; omit to link all top-level tourists."
                        },
                        "hotelName": {
                          "type": "string"
                        },
                        "stars": {
                          "type": "integer"
                        },
                        "address": {
                          "type": "string"
                        },
                        "phone": {
                          "type": "string"
                        },
                        "board": {
                          "type": "string"
                        },
                        "roomName": {
                          "type": "string"
                        },
                        "refundPolicy": {
                          "type": "string"
                        },
                        "pnr": {
                          "type": "string"
                        },
                        "airline": {
                          "type": "string"
                        },
                        "seat": {
                          "type": "string"
                        },
                        "fareClass": {
                          "type": "string"
                        },
                        "luggage": {
                          "type": "string"
                        },
                        "segments": {
                          "type": "array",
                          "items": {
                            "type": "object"
                          },
                          "description": "fly/railway/bus segments."
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created (order envelope + serviceIds of the new services)."
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/orders/{id}/payments/check": {
      "get": {
        "tags": [
          "Orders"
        ],
        "summary": "Check whether a payment exists",
        "description": "Returns whether a matching **outcome** bill exists for the given amount + currency. Trusted-integration scope: requires a staff/back-office role; a regular customer account gets 403.\n\n**Replaces legacy:** `GET /order/check-payment`.",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Travel Code order id."
          },
          {
            "name": "price",
            "in": "query",
            "required": true,
            "schema": {
              "type": "number"
            },
            "description": "Amount to match."
          },
          {
            "name": "currency",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "ISO-3. Defaults to BYN."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "orderId": {
                      "type": "integer"
                    },
                    "code": {
                      "type": "string"
                    },
                    "exists": {
                      "type": "boolean"
                    },
                    "billId": {
                      "type": "integer",
                      "nullable": true
                    },
                    "billDate": {
                      "type": "string",
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/orders/{id}/messages": {
      "post": {
        "tags": [
          "Orders"
        ],
        "summary": "Add a message / comment to an order",
        "description": "Adds a comment to the order. For the `chat` dialog type the order owner is also emailed + notified. Trusted-integration scope: requires a staff/back-office role (403 otherwise).\n\n**Replaces legacy:** `POST /order/send-message`.",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Travel Code order id."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "message"
                ],
                "properties": {
                  "message": {
                    "type": "string"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "comment",
                      "chat"
                    ],
                    "description": "Dialog type. Defaults to comment."
                  },
                  "commentType": {
                    "type": "string",
                    "description": "Defaults to message."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "orderId": {
                      "type": "integer"
                    },
                    "commentId": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/orders/{id}/services/{serviceId}": {
      "patch": {
        "tags": [
          "Orders"
        ],
        "summary": "Update an order-service field",
        "description": "Update a service's `innerOrderId` (e.g. an insurance policy number issued out of band). The service must belong to the order. Trusted-integration scope: requires a staff/back-office role (403 otherwise).\n\n**Replaces legacy:** `POST /order/update-insurance-inner-order-id`.",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Travel Code order id."
          },
          {
            "name": "serviceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "OrderService id (must belong to the order)."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "innerOrderId"
                ],
                "properties": {
                  "innerOrderId": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "orderId": {
                      "type": "integer"
                    },
                    "serviceId": {
                      "type": "integer"
                    },
                    "innerOrderId": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/orders/{id}/services/{serviceId}/seatmap": {
      "get": {
        "tags": [
          "Orders"
        ],
        "summary": "Seat map of a booked flight",
        "description": "The seat map of a booked, not yet issued flight, for choosing seats after booking.\n\nOffered exactly when the order page offers it: the booking is held (not issued, not cancelled), the supplier sells seats after booking (Amadeus, Sirena, Kyte), the airline does not seat only after ticketing, no seats were bought on the order yet (Kyte excepted) and the account owner has not hidden seat selection from employees. Otherwise `409` with code `154`.\n\nPrices are the client's, in the order currency. The map is read live from the airline, so read it right before buying.\n\n**Rules for a choice** (checked again by the purchase): a seat is free for a traveller only when its entry for that traveller has `available: true`; at most one seat per traveller per flight and at most `maxSeats` per flight; when `partialSelectionAllowed` is `false` every traveller on every flight must get a seat in one request (a seat already listed in `attachedSeats` counts as taken).",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Travel Code order id."
          },
          {
            "name": "serviceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The flight's OrderService id (must belong to the order), e.g. from `GET /v1/orders/{id}`."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "orderId": {
                      "type": "integer"
                    },
                    "serviceId": {
                      "type": "integer"
                    },
                    "currency": {
                      "type": "string",
                      "description": "Order currency, ISO-3; all prices are in it."
                    },
                    "partialSelectionAllowed": {
                      "type": "boolean",
                      "description": "`false`: seats are sold only for all travellers on all flights at once."
                    },
                    "flights": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Send this as `flightId` when buying."
                          },
                          "segmentId": {
                            "type": "string"
                          },
                          "departure": {
                            "type": "string",
                            "description": "IATA airport code."
                          },
                          "arrival": {
                            "type": "string",
                            "description": "IATA airport code."
                          },
                          "maxSeats": {
                            "type": "integer",
                            "description": "How many seats this flight takes in one purchase."
                          },
                          "travellers": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "description": "Send this as `travellerId` when buying."
                                },
                                "firstName": {
                                  "type": "string"
                                },
                                "lastName": {
                                  "type": "string"
                                }
                              }
                            }
                          },
                          "decks": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "width": {
                                  "type": "integer",
                                  "description": "Columns."
                                },
                                "length": {
                                  "type": "integer",
                                  "description": "Rows."
                                },
                                "exitRows": {
                                  "type": "array",
                                  "items": {
                                    "type": "integer"
                                  }
                                },
                                "wings": {
                                  "type": [
                                    "object",
                                    "null"
                                  ],
                                  "properties": {
                                    "fromRow": {
                                      "type": "integer"
                                    },
                                    "toRow": {
                                      "type": "integer"
                                    }
                                  }
                                },
                                "seats": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "number": {
                                        "type": "string",
                                        "example": "12A",
                                        "description": "Send this as `seat` when buying."
                                      },
                                      "row": {
                                        "type": "integer",
                                        "description": "Grid position (row) in the deck."
                                      },
                                      "column": {
                                        "type": "integer",
                                        "description": "Grid position (column) in the deck."
                                      },
                                      "characteristics": {
                                        "type": "array",
                                        "items": {
                                          "type": "string"
                                        },
                                        "description": "IATA seat characteristic codes (W window, A aisle, E exit row, ...)."
                                      },
                                      "travellers": {
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "properties": {
                                            "travellerId": {
                                              "type": "string",
                                              "description": "A traveller of this flight (`flights[].travellers[].id`)."
                                            },
                                            "available": {
                                              "type": "boolean",
                                              "description": "Only `true` may be bought. A traveller with no entry on a seat cannot take it."
                                            },
                                            "price": {
                                              "type": [
                                                "number",
                                                "null"
                                              ],
                                              "description": "The client's price in the order currency; `null` = free of charge. May be negative when the airline gives a discount."
                                            }
                                          }
                                        }
                                      }
                                    }
                                  }
                                },
                                "facilities": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "code": {
                                        "type": "string",
                                        "description": "LA lavatory, G galley, ..."
                                      },
                                      "row": {
                                        "type": "integer"
                                      },
                                      "column": {
                                        "type": "integer"
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    },
                    "attachedSeats": {
                      "type": "array",
                      "description": "Seats the airline already holds on this booking. Choosing the same seat again is refused.",
                      "items": {
                        "type": "object",
                        "properties": {
                          "travellerId": {
                            "type": "string"
                          },
                          "segmentId": {
                            "type": "string"
                          },
                          "seat": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token."
          },
          "404": {
            "description": "Order or service not found, or not visible to the caller."
          },
          "409": {
            "description": "Code `154`: seats cannot be chosen for this flight now (see the conditions above)."
          },
          "503": {
            "description": "Code `155`: the airline did not return a seat map. Try again later; if it keeps happening, seats cannot be chosen on this flight."
          }
        }
      }
    },
    "/v1/orders/{id}/services/{serviceId}/seats": {
      "post": {
        "tags": [
          "Orders"
        ],
        "summary": "Buy seats on a booked flight",
        "description": "Buys seats on a booked, not yet issued flight and adds them to the order as a seat service.\n\nSend only who sits where, with the ids from `GET .../seatmap`. The server reads the seat map from the airline again, checks the choice against it (rules in the seat map description) and takes the price from it — a price is never accepted from the caller. The seat price is added to the order.\n\nRequires the `orders:write` scope for OAuth clients. A frozen order (manual lock or closed accounting period) is refused with `403`. One purchase per flight runs at a time: a second request while the first is running gets `409` with code `156`.\n\nSirena may confirm a seat change later: then `409` with code `158` — the seats are added to the order once the airline confirms; do not send them again.",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Travel Code order id."
          },
          {
            "name": "serviceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The flight's OrderService id (must belong to the order), e.g. from `GET /v1/orders/{id}`."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "seats"
                ],
                "properties": {
                  "seats": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "object",
                      "required": [
                        "travellerId",
                        "flightId",
                        "seat"
                      ],
                      "properties": {
                        "travellerId": {
                          "type": "string",
                          "description": "`flights[].travellers[].id` of the seat map."
                        },
                        "flightId": {
                          "type": "string",
                          "description": "`flights[].id` of the seat map."
                        },
                        "seat": {
                          "type": "string",
                          "description": "`decks[].seats[].number`, e.g. `12A`."
                        }
                      }
                    }
                  }
                }
              },
              "example": {
                "seats": [
                  {
                    "travellerId": "1",
                    "flightId": "1",
                    "seat": "12A"
                  },
                  {
                    "travellerId": "2",
                    "flightId": "1",
                    "seat": "12B"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The seats were bought and added to the order.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "orderId": {
                      "type": "integer"
                    },
                    "serviceId": {
                      "type": "integer"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "seats": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "travellerId": {
                            "type": "string"
                          },
                          "flightId": {
                            "type": "string"
                          },
                          "seat": {
                            "type": "string"
                          },
                          "price": {
                            "type": "number",
                            "description": "The client's price in the order currency."
                          }
                        }
                      }
                    },
                    "total": {
                      "type": "number",
                      "description": "Sum of the seat prices, rounded to the currency."
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token."
          },
          "403": {
            "description": "The order is frozen (manual lock or closed accounting period); the reason is in the message."
          },
          "404": {
            "description": "Order or service not found, or not visible to the caller."
          },
          "409": {
            "description": "Code `154`: seats cannot be chosen for this flight now. Code `156`: seats are already being bought on this flight. Code `158`: the airline has not confirmed yet; the seats are added once it does — do not send them again."
          },
          "422": {
            "description": "`seats` is malformed, or the choice does not fit the seat map (unknown flight / traveller / seat, seat not available, more seats than the flight takes, not all at once where required, seat already held) or the airline refused it. The reason is in `seats[]` of the error details."
          },
          "500": {
            "description": "Code `157`: the seats could not be saved. Check the order before trying again — the airline may already hold them."
          },
          "503": {
            "description": "Code `155`: the airline did not return a seat map. Try again later."
          }
        }
      }
    },
    "/v1/user/me": {
      "get": {
        "tags": [
          "User"
        ],
        "summary": "Current user profile",
        "description": "Returns the authenticated caller (email, name, role, flags). Accepts a JWT, API token, or OAuth bearer token. Use this as the OAuth userinfo endpoint after authorizing.\n\n`travelerId` is the caller's own traveller card (passport data) — a different number from the account `id`. Resolution: the card bridged to the account, else the card the user pinned as their own, else their oldest live card whose traveller is not archived. `identityDocuments` are masked; full numbers come from `GET /v1/clients/{travelerId}/documents`.",
        "operationId": "getCurrentUser",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": []
          }
        ],
        "responses": {
          "200": {
            "description": "Authenticated user profile",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "integer"
                    },
                    "email": {
                      "type": "string",
                      "format": "email"
                    },
                    "firstName": {
                      "type": "string"
                    },
                    "lastName": {
                      "type": "string"
                    },
                    "companyId": {
                      "type": "integer",
                      "description": "Owner company id (ownerId or own id)"
                    },
                    "currency": {
                      "type": "string",
                      "example": "USD"
                    },
                    "lang": {
                      "type": "string",
                      "example": "en"
                    },
                    "source": {
                      "type": "string"
                    },
                    "role": {
                      "type": "integer"
                    },
                    "roleLabel": {
                      "type": "string",
                      "nullable": true
                    },
                    "userType": {
                      "type": "integer"
                    },
                    "userTypeLabel": {
                      "type": "string",
                      "nullable": true
                    },
                    "flags": {
                      "type": "object",
                      "properties": {
                        "isAdmin": {
                          "type": "boolean"
                        },
                        "isDirector": {
                          "type": "boolean"
                        },
                        "isTraveller": {
                          "type": "boolean"
                        }
                      }
                    },
                    "birthDate": {
                      "type": "string",
                      "format": "date",
                      "nullable": true
                    },
                    "nationality": {
                      "type": "string",
                      "nullable": true,
                      "description": "ISO-3166 alpha-2"
                    },
                    "gender": {
                      "type": "string",
                      "nullable": true,
                      "enum": [
                        "M",
                        "F"
                      ]
                    },
                    "identityDocuments": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/IdentityDocument"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token"
          }
        }
      }
    },
    "/v1/clients/search": {
      "get": {
        "tags": [
          "Clients"
        ],
        "summary": "Search clients",
        "description": "Find saved client profiles by name. Matches `LIKE %value%` on both Cyrillic and Latin forms simultaneously (`firstName`/`firstNameEn`, `lastName`/`lastNameEn`). At least one of `firstName` or `lastName` is required. Returns up to 50 records, sorted by last name then first name. Use the returned `id` with `get_client` to pull the full profile (including passport documents) when prefilling a booking — this is the recommended way to avoid duplicating clients in `/v1/orders/import`.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "firstName",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Substring of the first name (Cyrillic or Latin). Either `firstName` or `lastName` is required."
          },
          {
            "name": "lastName",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Substring of the last name (Cyrillic or Latin). Either `firstName` or `lastName` is required."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Client"
                      }
                    },
                    "fetched_at": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Neither `firstName` nor `lastName` was provided."
          }
        }
      }
    },
    "/v1/clients/{id}": {
      "get": {
        "tags": [
          "Clients"
        ],
        "summary": "Get client",
        "description": "Returns the full client profile including passport documents (`docs[]`) and loyalty memberships (`memberships[]`). Use this after `search_clients` to pull data for pre-filling a traveler block in `/v1/orders/import`. Returns 404 if the client is not accessible under your account.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Client ID from `search_clients`."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ClientDetails"
                    },
                    "fetched_at": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Client not found or not accessible under your account."
          }
        }
      },
      "put": {
        "tags": [
          "Clients"
        ],
        "summary": "Update a specific traveler profile by id",
        "description": "Updates a specific profile by id (POST is upsert-by-identity). Edits latin name / gender / DOB / nationality / email / phone; a document is added-or-updated by number, others kept. Cyrillic names untouched. Owner/manager scope; travellers 403.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ClientUpsertRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated profile (same shape as GET /v1/clients/{id})"
          },
          "400": {
            "description": "Validation error"
          },
          "401": {
            "description": "Missing/invalid Bearer"
          },
          "403": {
            "description": "Travellers cannot update"
          },
          "404": {
            "description": "Profile not in caller scope"
          }
        }
      }
    },
    "/v1/cardholders": {
      "get": {
        "tags": [
          "Cardholders"
        ],
        "summary": "List cardholders",
        "description": "Available to admins/developers and to client users granted virtual-cards access. Returns cardholders scoped to your environment.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "name": "sort",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "createdAt",
                "email",
                "lastName"
              ],
              "default": "createdAt"
            }
          },
          {
            "name": "sortOrder",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ],
              "default": "desc"
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Substring match on email, firstName, lastName."
          },
          {
            "name": "filter[status]",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "ACTIVE | INACTIVE | DEACTIVATED | INVITED. Comma-separated for multiple."
          },
          {
            "name": "filter[userId]",
            "in": "query",
            "schema": {
              "type": "integer"
            },
            "description": "Owner user id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CardholderList"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorEnvelope"
          }
        }
      },
      "post": {
        "tags": [
          "Cardholders"
        ],
        "summary": "Create cardholder",
        "description": "Available to admins/developers and to client users granted virtual-cards access. Creates a cardholder via the card provider and persists it. New cardholders are usually created as INVITED and become ACTIVE shortly after (provider confirmation).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CardholderCreateRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Cardholder"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ErrorEnvelope"
          },
          "403": {
            "$ref": "#/components/responses/ErrorEnvelope"
          },
          "409": {
            "$ref": "#/components/responses/ErrorEnvelope"
          }
        }
      }
    },
    "/v1/cardholders/{id}": {
      "get": {
        "tags": [
          "Cardholders"
        ],
        "summary": "Get cardholder",
        "description": "Available to admins/developers and to client users granted virtual-cards access. `id` is the cardholder UUID.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Cardholder UUID."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Cardholder"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "tags": [
          "Cardholders"
        ],
        "summary": "Deactivate cardholder",
        "description": "Available to admins/developers and to client users granted virtual-cards access. Irreversible (status → DEACTIVATED). Refused (error `CARDHOLDER_HAS_ACTIVE_CARDS`) if the cardholder still has ACTIVE/LOCKED cards — terminate them first.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Cardholder UUID."
          }
        ],
        "responses": {
          "204": {
            "description": "No Content"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/ErrorEnvelope"
          }
        }
      },
      "patch": {
        "tags": [
          "Cardholders"
        ],
        "summary": "Update cardholder",
        "description": "Available to admins/developers and to client users granted virtual-cards access. Updates mutable cardholder fields via the card provider. Fields are optional; send only what changes.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Cardholder UUID."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CardholderUpdateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Cardholder"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ErrorEnvelope"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/virtual-cards": {
      "get": {
        "tags": [
          "Virtual Cards"
        ],
        "summary": "List virtual cards",
        "description": "Available to admins/developers and to client users granted virtual-cards access, scoped to your environment. Sensitive data is never returned here.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "name": "sort",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "createdAt",
                "limitValue",
                "status"
              ],
              "default": "createdAt"
            }
          },
          {
            "name": "sortOrder",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ],
              "default": "desc"
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Substring match on maskedPan, label, cardId."
          },
          {
            "name": "filter[status]",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "ACTIVE | USED | TERMINATED | EXPIRED | LOCKED. Comma-separated for multiple."
          },
          {
            "name": "filter[cardholderId]",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "filter[orderId]",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "filter[userId]",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VirtualCardList"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorEnvelope"
          }
        }
      },
      "post": {
        "tags": [
          "Virtual Cards"
        ],
        "summary": "Issue a virtual card",
        "description": "Available to admins/developers and to client users granted virtual-cards access. Issues a card for an existing ACTIVE cardholder. Organization balance is checked before issuing. The response includes the `sensitive` block (PAN/CVV) — the only moment it is returned on creation; store it if you need it.\n\nOptional header `Idempotency-Key: <unique>` protects against double issuance on retries: same key + same body replays the stored response (no second card); same key + different body → `IDEMPOTENCY_KEY_REUSED`; a concurrent in-flight request → `REQUEST_IN_PROGRESS`. Use a new key for an intentional second card.\n\nError codes: `INSUFFICIENT_BALANCE`, `CARDHOLDER_INACTIVE`, `CARD_ISSUE_FAILED`.\n\nTravel configs return the card immediately as ACTIVE with the `sensitive` block populated. Configs with `requiresSanctionScreening: true` (see GET /v1/virtual-cards/configs) are issued asynchronously: the response comes back with `status: PENDING` and `sensitive: null`. Poll GET /v1/virtual-cards/{id} until `status` becomes ACTIVE, then use the two-step reveal to obtain PAN/CVV.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Optional. Deduplicates retries of the same logical create."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VirtualCardCreateRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VirtualCardWithSensitive"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ErrorEnvelope"
          },
          "403": {
            "$ref": "#/components/responses/ErrorEnvelope"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/ErrorEnvelope"
          }
        }
      }
    },
    "/v1/virtual-cards/configs": {
      "get": {
        "tags": [
          "Virtual Cards"
        ],
        "summary": "List available card configs",
        "description": "Available to admins/developers and to client users granted virtual-cards access. Card types available for issuing in your environment (filtered to the prod-allowed set for non-developer users). Use `cardConfig` when creating a card; `name`/`description`/`imagePath` are ready for UI rendering.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/VirtualCardConfig"
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorEnvelope"
          }
        }
      }
    },
    "/v1/virtual-cards/{id}": {
      "get": {
        "tags": [
          "Virtual Cards"
        ],
        "summary": "Get virtual card",
        "description": "Available to admins/developers and to client users granted virtual-cards access. `id` is the card UUID. Does NOT return sensitive data — use the reveal flow for PAN/CVV. Error code `UNKNOWN_SCOPE` for an unknown scope value.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Card UUID."
          },
          {
            "name": "scope",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Comma-separated optional blocks: `cardholder`, `address`, `controls`."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VirtualCardWithScope"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ErrorEnvelope"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "patch": {
        "tags": [
          "Virtual Cards"
        ],
        "summary": "Update virtual card",
        "description": "Available to admins/developers and to client users granted virtual-cards access. Partial update: status (lock/unlock) and/or limit. A limit increase is checked against the organization balance; the currency must match the card. Only ACTIVE/LOCKED cards can be modified. Error codes: `INSUFFICIENT_BALANCE`, `CURRENCY_MISMATCH`, `CARD_NOT_MUTABLE`.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Card UUID."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VirtualCardUpdateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VirtualCard"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ErrorEnvelope"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/ErrorEnvelope"
          }
        }
      },
      "delete": {
        "tags": [
          "Virtual Cards"
        ],
        "summary": "Terminate virtual card",
        "description": "Available to admins/developers and to client users granted virtual-cards access. Irreversible (status → TERMINATED). Error code `CARD_ALREADY_TERMINATED` if already terminated.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Card UUID."
          }
        ],
        "responses": {
          "204": {
            "description": "No Content"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/ErrorEnvelope"
          }
        }
      }
    },
    "/v1/virtual-cards/{id}/reveal/request": {
      "post": {
        "tags": [
          "Virtual Cards"
        ],
        "summary": "Request a card reveal code (step 1)",
        "description": "Available to admins/developers and to client users granted virtual-cards access. Generates a 6-digit one-time code (valid 5 minutes), bound to this card, and emails it to the card owner. In dev the code is always `123456` and no email is sent. Step 2 is POST /v1/virtual-cards/{id}/reveal.\n\nBrute-force guard: after 5 wrong codes the reveal is locked for ~24h (`OTP_LOCKED`); this also blocks requesting new codes. A terminated card cannot be revealed (`CARD_ALREADY_TERMINATED`). A card that is still PENDING cannot be revealed yet (`CARD_NOT_READY`).\n\nFor some clients OTP is not required: this endpoint then returns the full card with `otpSent: false` and its `sensitive` block directly, in a single call (no step 2). Branch on the `otpSent` field: false means the data is in this response; true means a code was emailed and POST /reveal is required. Scope blocks (cardholder/address) are not parsed on this path.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Card UUID."
          }
        ],
        "responses": {
          "200": {
            "description": "OK. Either { otpSent: true } (a code was emailed, proceed to step 2), or for clients that don't require OTP the full card with otpSent:false and its sensitive block (no step 2 needed).",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/RevealRequestAccepted"
                    },
                    {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/VirtualCardReveal"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "otpSent": {
                              "type": "boolean",
                              "description": "false on this one-call path (no OTP was sent)."
                            }
                          }
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/ErrorEnvelope"
          },
          "429": {
            "$ref": "#/components/responses/ErrorEnvelope"
          }
        }
      }
    },
    "/v1/virtual-cards/{id}/reveal": {
      "post": {
        "tags": [
          "Virtual Cards"
        ],
        "summary": "Reveal card sensitive data (step 2)",
        "description": "Available to admins/developers and to client users granted virtual-cards access. Verifies the one-time `code` from step 1 and returns the full card with its `sensitive` block (PAN/CVV/expiry). The code is bound to this specific card and is consumed only on a successful match. Optional `scope` adds `cardholder`/`address`. Error codes: `OTP_INVALID`, `OTP_EXPIRED`, `OTP_LOCKED`, `CARD_ALREADY_TERMINATED`, `CARD_NOT_READY` (card still PENDING), `CARD_REVEAL_FAILED` (provider rejected the PCI fetch).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Card UUID."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "code"
                ],
                "properties": {
                  "code": {
                    "type": "string",
                    "description": "6-digit code from step 1.",
                    "example": "123456"
                  },
                  "scope": {
                    "type": "string",
                    "description": "Comma-separated optional blocks: `cardholder`, `address`."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VirtualCardReveal"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ErrorEnvelope"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/ErrorEnvelope"
          },
          "429": {
            "$ref": "#/components/responses/ErrorEnvelope"
          }
        }
      }
    },
    "/v1/virtual-cards/card-accounts": {
      "get": {
        "tags": [
          "Virtual Cards"
        ],
        "summary": "List organization card accounts",
        "description": "Available to admins/developers and to client users granted virtual-cards access. Returns the organization's card accounts. Each account has a fixed currency — a card issued under it inherits that currency. Use the returned `id` as `cardAccountId` when creating a card to pick the funding account (and therefore the card's currency). Financial fields (credit limit / available limit / balance) are intentionally not exposed: the public API does not disclose organization funds.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/CardAccount"
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorEnvelope"
          }
        }
      }
    },
    "/v1/virtual-cards/recommend-config": {
      "get": {
        "tags": [
          "Virtual Cards"
        ],
        "summary": "Recommend a card config for a merchant",
        "description": "Available to admins/developers and to client users granted virtual-cards access. Returns the card config with the best net cashback for the given merchant, to pre-select in the issue flow.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "merchant",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Merchant name to match."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecommendedConfig"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ErrorEnvelope"
          }
        }
      }
    },
    "/v1/virtual-cards/transactions": {
      "get": {
        "tags": [
          "Virtual Cards"
        ],
        "summary": "List virtual-card transactions",
        "description": "Available to admins/developers and to client users granted virtual-cards access. Paged, filterable ledger of card transactions, scoped to your organization.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 25
            }
          },
          {
            "name": "sort",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "transactionDate",
                "amount",
                "status",
                "type"
              ],
              "default": "transactionDate"
            }
          },
          {
            "name": "sortOrder",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ],
              "default": "desc"
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Substring match on merchantName, transactionId, cardId."
          },
          {
            "name": "filter[cardId]",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "filter[status]",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "PENDING | CONFIRMED | DECLINED | REVERSED | BOOKED. Comma-separated for multiple."
          },
          {
            "name": "filter[type]",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "filter[dateFrom]",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "transactionDate >= (Y-m-d)."
          },
          {
            "name": "filter[dateTo]",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "transactionDate <= (Y-m-d)."
          },
          {
            "name": "embedded",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Comma-separated related objects to inline: `card`, `cardholder`."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VirtualCardTransactionList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ErrorEnvelope"
          }
        }
      }
    },
    "/v1/virtual-cards/transactions/{id}": {
      "get": {
        "tags": [
          "Virtual Cards"
        ],
        "summary": "Get a virtual-card transaction",
        "description": "Available to admins/developers and to client users granted virtual-cards access. Returns a single transaction by its provider transaction id, scoped to your organization.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Provider transaction id."
          },
          {
            "name": "embedded",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Comma-separated related objects to inline: `card`, `cardholder`."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VirtualCardTransaction"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/virtual-cards/balance": {
      "get": {
        "tags": [
          "Virtual Cards"
        ],
        "summary": "Get organization balance",
        "description": "Available to admins/developers and to client users granted virtual-cards access. Returns the caller organization's wallet balance (credit limit, available limit, current balance). Scoped to your organization.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationBalance"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ErrorEnvelope"
          }
        }
      }
    },
    "/v1/virtual-cards/control-options": {
      "get": {
        "tags": [
          "Virtual Cards"
        ],
        "summary": "Card controls reference dictionaries",
        "description": "Static dictionaries for building the card-controls UI (restrictions, categories, group types, currencies, acceptance methods, IANA timezones). Same access gate as other virtual-cards endpoints. merchants/locations return no value list (free input).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ControlOptions"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorEnvelope"
          }
        }
      }
    },
    "/v1/virtual-cards/subscriptions/events": {
      "get": {
        "tags": [
          "Virtual Cards"
        ],
        "summary": "List subscribable webhook event types",
        "description": "Catalog of event types you can subscribe to, grouped by entity. Source of truth for the `eventTypes` accepted by the replace/delete endpoints. Available to admins/developers and to client users granted virtual-cards access.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionEventsCatalog"
                }
              }
            }
          }
        }
      }
    },
    "/v1/virtual-cards/subscriptions": {
      "get": {
        "tags": [
          "Virtual Cards"
        ],
        "summary": "List all webhook subscriptions",
        "description": "All webhook subscriptions of your organization, grouped by entity. Pliant is the source of truth (no local storage); requests are proxied under your organization's credentials.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionListGrouped"
                }
              }
            }
          }
        }
      }
    },
    "/v1/virtual-cards/subscriptions/{entity}": {
      "get": {
        "tags": [
          "Virtual Cards"
        ],
        "summary": "List webhook subscriptions for one entity",
        "description": "Subscriptions of a single entity.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "entity",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "transactions",
                "cards",
                "cardholders",
                "card-controls"
              ]
            },
            "description": "Subscription entity slug."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionListForEntity"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "tags": [
          "Virtual Cards"
        ],
        "summary": "Replace webhook subscriptions for one entity",
        "description": "Desired-state replace: after the call the entity's subscriptions are exactly `eventTypes`, all pointing at the supplied `callbackUrl`. Manageable entities: `transactions`, `cards`, `cardholders` (`card-controls` is read-only). Error codes: `400` empty/unknown `eventTypes` or invalid `callbackUrl` (code 11, per-field details in `message`); `404` unknown or unmanageable entity (code 5).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "entity",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "transactions",
                "cards",
                "cardholders"
              ]
            },
            "description": "Subscription entity slug."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubscriptionReplaceRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Resulting subscription state for the entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionListForEntity"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ErrorEnvelope"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "tags": [
          "Virtual Cards"
        ],
        "summary": "Delete webhook subscriptions for one entity",
        "description": "Unsubscribe the given event types for one entity. Manageable entities: `transactions`, `cards`, `cardholders`. Error codes: `400` empty/unknown `eventTypes` (code 11); `404` unknown or unmanageable entity (code 5).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "entity",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "transactions",
                "cards",
                "cardholders"
              ]
            },
            "description": "Subscription entity slug."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubscriptionDeleteRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Resulting subscription state for the entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionListForEntity"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ErrorEnvelope"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/virtual-cards/subscriptions/signing-key": {
      "get": {
        "tags": [
          "Virtual Cards"
        ],
        "summary": "Get the webhook signing key",
        "description": "The public key used to verify **incoming** webhook signatures (Ed25519, Standard Webhooks scheme). Pliant's JWKS endpoint requires API credentials, so this proxies it under your organization — each org signs with its own key. Available to admins/developers and to client users granted virtual-cards access.\n\n**How to read an incoming webhook.** Pliant POSTs a JSON body to your callback URL; verify the signature before trusting it:\n\n1. Read the headers: `webhook-id` (unique delivery id, same as `X-Callback-Id` — use it for idempotency), `webhook-timestamp` (unix seconds), `webhook-signature` (format `v1a,<base64>`; may carry several space-separated signatures — any match is enough). Also `X-Organization-Id`, `X-Callback-Created-At`.\n2. Fetch the key from this endpoint — `publicKey` (Ed25519, base64url) or the full `jwks`. You may cache it.\n3. Build the signed content `{webhook-id}.{webhook-timestamp}.{raw body}`, where the body is byte-for-byte as received (do not re-serialize the parsed JSON, do not change key order/whitespace), UTF-8.\n4. Base64-decode the part after the `v1a,` prefix and verify the Ed25519 signature over that string with the public key. No match → reject (401).\n5. Replay protection: reject if `webhook-timestamp` differs from the current time by more than ±5 minutes.\n6. Idempotency: on any non-2xx Pliant redelivers, so dedupe by `webhook-id` and process each event once.\n7. Respond 2xx quickly; any non-2xx triggers redelivery.\n\nDetermine the callback's content from the body: `eventType` (cards/cardholders: `CARD_*` / `CARDHOLDER_*`), or `type` (`REFUND` / `PURCHASE` / …) together with `status` for transactions; entity ids are `transactionId` / `cardId` / `cardholderId`. The full event list is at `GET /v1/virtual-cards/subscriptions/events`.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookSigningKey"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ErrorEnvelope"
          }
        }
      }
    },
    "/v1/companies/travel-policies": {
      "get": {
        "tags": [
          "Travel Policy"
        ],
        "summary": "List company travel policies",
        "description": "Owner-scoped list. Roles: DIRECTOR, TRAVEL_MANAGER (admin bypass).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/TravelPolicy"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TravelPolicyErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TravelPolicyErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Travel Policy"
        ],
        "summary": "Create a travel policy",
        "description": "Role DIRECTOR. Only name is required; every rule section is optional. 403 if the plan policy limit is reached.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TravelPolicyInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TravelPolicy"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TravelPolicyErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TravelPolicyErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TravelPolicyErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/v1/companies/travel-policies/{id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "integer"
          },
          "description": "Policy id (within the caller company)"
        }
      ],
      "get": {
        "tags": [
          "Travel Policy"
        ],
        "summary": "Get a travel policy",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TravelPolicy"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TravelPolicyErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TravelPolicyErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TravelPolicyErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Travel Policy"
        ],
        "summary": "Update a travel policy (full replace of managed fields)",
        "description": "Role DIRECTOR. Omitted fields/sections reset to unset; scope replaced wholesale. Settings not modeled by the API (e.g. split-payment) are preserved.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TravelPolicyInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TravelPolicy"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TravelPolicyErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TravelPolicyErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TravelPolicyErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TravelPolicyErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Travel Policy"
        ],
        "summary": "Delete a travel policy",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "deleted": {
                      "type": "boolean",
                      "example": true
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TravelPolicyErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TravelPolicyErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TravelPolicyErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/v1/companies/travel-policies/{id}/check": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "integer"
          },
          "description": "Policy id (within the caller company)"
        }
      ],
      "post": {
        "tags": [
          "Travel Policy"
        ],
        "summary": "Check an offer against a policy",
        "description": "Evaluates a flight/hotel/train offer against policy {id}. Dates are required for min-days/working-days rules (departureDate / checkinDate) or the result may be a false violation. entity=expense is not supported yet (422).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TravelPolicyCheckRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TravelPolicyCheckResponse"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TravelPolicyErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TravelPolicyErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TravelPolicyErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TravelPolicyErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/v1/companies/travel-policies/schema": {
      "get": {
        "tags": [
          "Travel Policy"
        ],
        "summary": "Get the travel-policy field schema (for AI/LLM)",
        "description": "Role DIRECTOR/TRAVEL_MANAGER/DEVELOPER. Returns a JSON schema describing every policy field. An LLM fetches it once, then builds a payload for POST /from-json by it.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "JSON schema of the from-JSON create payload",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TravelPolicyErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/v1/companies/travel-policies/from-json": {
      "post": {
        "tags": [
          "Travel Policy"
        ],
        "summary": "Create a draft travel policy from AI/LLM JSON",
        "description": "Role DIRECTOR. Robert parses a client PDF into JSON and calls this. The policy is created as a DRAFT with no scope (roles/users), so it enforces nothing until a human assigns scope in the editor. Approval routing is forced off (approver ids cannot be derived from a document). 403 if the plan policy limit is reached.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TravelPolicyFromJsonInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Draft created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TravelPolicyDraft"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TravelPolicyErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TravelPolicyErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TravelPolicyErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/v1/user/recent-travelers": {
      "get": {
        "tags": [
          "User"
        ],
        "summary": "Recent distinct travelers from the caller orders (masked documents)",
        "description": "Distinct travelers from the caller's recent orders, most-recent first, deduped by person. For one-click co-traveler prefill. Passport numbers are MASKED; the full number is resolved server-side at order creation from travelerId.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 10,
              "maximum": 50
            },
            "description": "Max travelers (1-50)"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/RecentTraveler"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing/invalid Bearer token"
          }
        }
      }
    },
    "/v1/clients/{id}/documents": {
      "get": {
        "tags": [
          "Clients"
        ],
        "summary": "Documents of a traveler profile (full numbers, manager scope)",
        "description": "Profile documents, owner/manager scoped, FULL numbers (profile management). Masked chat/prefill view is GET /v1/user/recent-travelers.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ClientDocument"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing/invalid Bearer"
          },
          "404": {
            "description": "Profile not in caller scope"
          }
        }
      }
    },
    "/v1/users/by-phone": {
      "get": {
        "tags": [
          "Users (service)"
        ],
        "summary": "Resolve a phone number to employee candidates (API token only)",
        "description": "M2M lookup for voice caller identification. Phone is not unique -> returns candidates; caller confirms via email code. Match on digits, last-9 fallback (local vs international). Scope: company token = own company, admin/service = all. ACTIVE only, capped 20.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "phone",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Any format; normalized to digits server-side"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "userId": {
                            "type": "integer"
                          },
                          "email": {
                            "type": "string"
                          },
                          "firstName": {
                            "type": "string"
                          },
                          "phone": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "phone missing/empty"
          },
          "401": {
            "description": "Missing/invalid Bearer or non-API-token auth"
          }
        }
      }
    },
    "/v1/expenses": {
      "get": {
        "tags": [
          "Expenses"
        ],
        "summary": "List the authenticated user's expenses",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "tripId",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 20,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ExpenseRow"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing/invalid Bearer"
          }
        }
      },
      "post": {
        "tags": [
          "Expenses"
        ],
        "summary": "Record an expense (created as pending)",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExpenseCreateRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExpenseRow"
                }
              }
            }
          },
          "400": {
            "description": "Missing required / invalid occurredAt / unsupported currency"
          },
          "401": {
            "description": "Missing/invalid Bearer"
          },
          "422": {
            "description": "Validation error (bad category, tripId not the caller's)"
          }
        }
      }
    },
    "/v1/off-platform-bookings": {
      "get": {
        "tags": [
          "Off-platform bookings"
        ],
        "summary": "List off-platform bookings",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Newest first. A traveller sees their own bookings; a company administrator or travel manager sees the whole company.",
        "parameters": [
          {
            "name": "confirmationNumber",
            "in": "query",
            "description": "Exact confirmation number — use it to find a booking before sending it again.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "travelerName",
            "in": "query",
            "required": false,
            "description": "Part of the traveller's name",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "country",
            "in": "query",
            "required": false,
            "description": "Country text in `locations` (part of it matches)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "dateFrom",
            "in": "query",
            "required": false,
            "description": "Trips that end on or after this date",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "dateTo",
            "in": "query",
            "required": false,
            "description": "Trips that start on or before this date",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "createdFrom",
            "in": "query",
            "required": false,
            "description": "Recorded on or after",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "createdTo",
            "in": "query",
            "required": false,
            "description": "Recorded on or before",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 20,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of bookings",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OffPlatformBookingList"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token"
          }
        }
      },
      "post": {
        "tags": [
          "Off-platform bookings"
        ],
        "summary": "Record an off-platform booking",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Records a booking made outside Travel Code for the caller or for a traveller of the same company.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OffPlatformBookingCreateRequest"
              },
              "example": {
                "type": "hotel",
                "user_id": 48211,
                "dates": {
                  "from": "2026-12-14",
                  "to": "2026-12-17"
                },
                "locations": [
                  {
                    "country": "Germany",
                    "city": "Berlin"
                  }
                ],
                "details": {
                  "title": "Hotel Adlon Kempinski",
                  "traveler": "ANNA MUELLER",
                  "roomType": "Deluxe King"
                },
                "total_price": 1240.5,
                "currency": "EUR",
                "confirmation_number": "ADL-58213"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OffPlatformBooking"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token"
          },
          "403": {
            "description": "The traveller belongs to another company, or a guest records for someone else"
          },
          "400": {
            "description": "`type` missing"
          },
          "422": {
            "description": "Validation error: unknown `type`, `user_id` or `currency`, negative price, a cancelled trip in `order_id`, …"
          }
        }
      }
    },
    "/v1/companies/entitlements": {
      "get": {
        "tags": [
          "Companies"
        ],
        "summary": "Caller company's plan-derived entitlements (Robert task quotas)",
        "description": "Roles DIRECTOR / TRAVEL_MANAGER (admin bypass). Own-company scope. Effective limit = perSeatIncluded + addonPerSeat * addonSeats; enforced in robert-service. addonSeats is 0 for now (add-on billing not implemented).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "plan": {
                      "type": "string",
                      "enum": [
                        "starter",
                        "premium",
                        "pro"
                      ]
                    },
                    "robertTasks": {
                      "type": "object",
                      "properties": {
                        "perSeatIncluded": {
                          "type": "integer",
                          "description": "starter 0 / premium 5 / pro 25"
                        },
                        "addonPerSeat": {
                          "type": "integer",
                          "description": "seats per add-on pack (25)"
                        },
                        "addonSeats": {
                          "type": "integer",
                          "description": "purchased add-on seats (0 for now)"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing/invalid Bearer"
          },
          "403": {
            "description": "Role not allowed"
          }
        }
      }
    },
    "/v1/auto-approval-rules": {
      "get": {
        "tags": [
          "Auto-approval rules"
        ],
        "summary": "List the caller's auto-approval rules",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AutoApprovalRule"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing/invalid Bearer"
          }
        }
      },
      "post": {
        "tags": [
          "Auto-approval rules"
        ],
        "summary": "Create an auto-approval rule",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AutoApprovalRuleInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutoApprovalRule"
                }
              }
            }
          },
          "401": {
            "description": "Missing/invalid Bearer"
          },
          "422": {
            "description": "Validation error"
          }
        }
      }
    },
    "/v1/auto-approval-rules/{id}": {
      "put": {
        "tags": [
          "Auto-approval rules"
        ],
        "summary": "Update one of the caller's rules",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AutoApprovalRuleInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutoApprovalRule"
                }
              }
            }
          },
          "401": {
            "description": "Missing/invalid Bearer"
          },
          "404": {
            "description": "Rule not found"
          },
          "422": {
            "description": "Validation error"
          }
        }
      },
      "delete": {
        "tags": [
          "Auto-approval rules"
        ],
        "summary": "Delete one of the caller's rules",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing/invalid Bearer"
          },
          "404": {
            "description": "Rule not found"
          }
        }
      }
    },
    "/v1/competitive-offer/find": {
      "post": {
        "tags": [
          "Competitive offer"
        ],
        "summary": "Find our competitive offer for a parsed competitor price",
        "description": "Matching variant C: run a normal flight search first, then pass its cacheId (+ optional itemId). Returns a special price between our netto and retail. netto/margin are never returned (audit only). Selling below retail is opt-in per company (enable_competitive_pricing).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompetitiveOfferFindRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompetitiveOfferResult"
                }
              }
            }
          },
          "401": {
            "description": "Missing/invalid Bearer"
          },
          "422": {
            "description": "Validation error (missing cacheId/competitor_price)"
          }
        }
      }
    },
    "/v1/virtual-cards/statements": {
      "get": {
        "tags": [
          "Virtual Cards"
        ],
        "summary": "List statements",
        "description": "Monthly account statements (summary only). Pure local read — no provider call. Tenant + environment scoped.",
        "parameters": [
          {
            "name": "filter[cardAccountId]",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "filter[isClosed]",
            "in": "query",
            "schema": {
              "type": "boolean"
            },
            "description": "Closed (finalized) vs ongoing statements."
          },
          {
            "name": "filter[dateFrom]",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "periodEnd >= (Y-m-d)."
          },
          {
            "name": "filter[dateTo]",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "periodEnd <= (Y-m-d)."
          },
          {
            "name": "sort",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "periodEnd",
                "periodStart",
                "closingBalance",
                "statementCreatedAt"
              ],
              "default": "periodEnd"
            }
          },
          {
            "name": "sortOrder",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ],
              "default": "desc"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 25
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VirtualCardStatementList"
                }
              }
            }
          }
        }
      }
    },
    "/v1/virtual-cards/statements/{id}": {
      "get": {
        "tags": [
          "Virtual Cards"
        ],
        "summary": "Get one statement (+ scoped line items)",
        "description": "`{id}` is the statementId. Without `scope` — summary only (local, no provider call). With `scope` — one live provider read of the statement entries, enriched from local tables (entry order preserved).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "scope",
            "in": "query",
            "description": "Comma-separated: bills, transactions.",
            "schema": {
              "type": "string",
              "example": "bills,transactions"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VirtualCardStatementDetail"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ErrorEnvelope"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/virtual-cards/statements/{id}/download": {
      "get": {
        "tags": [
          "Virtual Cards"
        ],
        "summary": "Download statement PDF",
        "description": "Pass-through of the provider PDF. Available only for a closed statement (isClosed=true); otherwise 400 (code 101 STATEMENT_PDF_NOT_READY). The PDF is generated on the 2nd business day of the next month.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "pdf"
              ],
              "default": "pdf"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The statement PDF file (Content-Disposition: attachment).",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ErrorEnvelope"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/virtual-cards/statements-sync": {
      "post": {
        "tags": [
          "Virtual Cards"
        ],
        "summary": "Backfill statements (and their bill payments)",
        "description": "Fills the local statement summaries and — as a side effect — the BILL_PAYMENT payments referenced by their entries. Idempotent (statementId/paymentId unique). Admin/developer.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "fromDate": {
                    "type": "string",
                    "format": "date"
                  },
                  "toDate": {
                    "type": "string",
                    "format": "date"
                  },
                  "cardAccountId": {
                    "type": "string"
                  },
                  "isClosed": {
                    "type": "boolean"
                  },
                  "pageSize": {
                    "type": "integer",
                    "default": 50
                  },
                  "maxPages": {
                    "type": "integer",
                    "default": 200
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VirtualCardStatementSyncResult"
                }
              }
            }
          }
        }
      }
    },
    "/v1/categories": {
      "get": {
        "tags": [
          "Categories"
        ],
        "summary": "List categories",
        "description": "Paged/searchable spend categories. Search matches title/code/giCode.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "filter[status]",
            "in": "query",
            "schema": {
              "type": "boolean"
            },
            "description": "Enabled (1) / disabled (0)."
          },
          {
            "name": "sort",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "id",
                "title",
                "code",
                "status"
              ],
              "default": "id"
            }
          },
          {
            "name": "sortOrder",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ],
              "default": "asc"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 25
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CategoryList"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Categories"
        ],
        "summary": "Create category",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "title",
                  "code"
                ],
                "properties": {
                  "title": {
                    "type": "string"
                  },
                  "code": {
                    "type": "string",
                    "description": "Unique."
                  },
                  "status": {
                    "type": "boolean",
                    "default": true
                  },
                  "giCode": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Category"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ErrorEnvelope"
          },
          "409": {
            "$ref": "#/components/responses/ErrorEnvelope"
          }
        }
      }
    },
    "/v1/categories/{id}": {
      "get": {
        "tags": [
          "Categories"
        ],
        "summary": "Get one category",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Category"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "tags": [
          "Categories"
        ],
        "summary": "Update category (partial)",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string"
                  },
                  "code": {
                    "type": "string"
                  },
                  "status": {
                    "type": "boolean"
                  },
                  "giCode": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Category"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/ErrorEnvelope"
          }
        }
      },
      "delete": {
        "tags": [
          "Categories"
        ],
        "summary": "Delete category",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No Content"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/virtual-cards/bank-accounts": {
      "get": {
        "tags": [
          "Virtual Cards"
        ],
        "summary": "List external bank accounts",
        "description": "Available to admins/developers and to client users granted virtual-cards access. Returns the organization's external (destination) bank accounts — the payout targets. Use a returned `bankAccountId` as the `bankAccountId` when creating a payout. Read-only proxy: external bank accounts are registered on Pliant's side (onboarding / dashboard); the partner API cannot create them.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0
            },
            "description": "Offset; mapped to the provider's page = offset / limit."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            },
            "description": "Page size (max 200)."
          },
          {
            "name": "sort",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "id",
                "createdAt",
                "bankName"
              ]
            }
          },
          {
            "name": "sortOrder",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "ASC",
                "DESC"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ExternalBankAccount"
                      }
                    },
                    "hasNextPage": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorEnvelope"
          }
        }
      }
    },
    "/v1/virtual-cards/bank-accounts/{id}": {
      "get": {
        "tags": [
          "Virtual Cards"
        ],
        "summary": "Get an external bank account",
        "description": "Available to admins/developers and to client users granted virtual-cards access. Returns a single external bank account by its `bankAccountId`, scoped to your organization.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "External bank account id (`bankAccountId`)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExternalBankAccount"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/virtual-cards/card-accounts/{id}/payout": {
      "post": {
        "tags": [
          "Virtual Cards"
        ],
        "summary": "Pay out from a card account",
        "description": "Move funds out of the card account `{id}` (`cardAccountId`) to a registered external bank account (`bankAccountId`, from the bank-accounts endpoint). Money movement — stricter access than the other endpoints: on top of the virtual-cards access gate, the caller must hold a company-admin role (`ADMIN`, `DEVELOPER`, `DIRECTOR`, `TOP_MANAGER`, `ACCOUNTANT`); the role is checked explicitly, so no other admin role bypasses it and an ordinary employee cannot pay out. `amount.value` is in major units and converted to provider minor units. Error codes: `400` invalid `bankAccountId` / `amount.value` / `currency` (code 11); `403` missing company-admin role or access gate not passed (code 6).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Card account id (`cardAccountId`)."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PayoutRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The created payment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Payout"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ErrorEnvelope"
          },
          "403": {
            "$ref": "#/components/responses/ErrorEnvelope"
          }
        }
      }
    },
    "/v1/airline-commissions/programs": {
      "get": {
        "tags": [
          "Airline Commissions"
        ],
        "summary": "Programs in force",
        "operationId": "listCommissionPrograms",
        "description": "Every approved commission program whose travel period has not ended, each with the document it came from.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "airline",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "example": "AA"
            },
            "description": "Only programs of this airline (IATA code)"
          }
        ],
        "responses": {
          "200": {
            "description": "Programs",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "schemaVersion",
                    "generatedAt",
                    "programs"
                  ],
                  "properties": {
                    "schemaVersion": {
                      "type": "string",
                      "const": "1.0"
                    },
                    "generatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "programs": {
                      "type": "array",
                      "items": {
                        "allOf": [
                          {
                            "$ref": "#/components/schemas/CommissionProgram"
                          },
                          {
                            "type": "object",
                            "properties": {
                              "source": {
                                "$ref": "#/components/schemas/CommissionSource"
                              }
                            }
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token"
          },
          "403": {
            "description": "Your account is not connected to the commission service — write to api@travel-code.com"
          }
        }
      }
    },
    "/v1/airline-commissions/programs/{code}": {
      "get": {
        "tags": [
          "Airline Commissions"
        ],
        "summary": "One program",
        "operationId": "getCommissionProgram",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "AJBS6"
            },
            "description": "Program code as printed on the grid"
          }
        ],
        "responses": {
          "200": {
            "description": "The program",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "schemaVersion",
                    "generatedAt",
                    "programs"
                  ],
                  "properties": {
                    "schemaVersion": {
                      "type": "string",
                      "const": "1.0"
                    },
                    "generatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "programs": {
                      "type": "array",
                      "items": {
                        "allOf": [
                          {
                            "$ref": "#/components/schemas/CommissionProgram"
                          },
                          {
                            "type": "object",
                            "properties": {
                              "source": {
                                "$ref": "#/components/schemas/CommissionSource"
                              }
                            }
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token"
          },
          "403": {
            "description": "Your account is not connected to the commission service — write to api@travel-code.com"
          },
          "404": {
            "description": "No program in force with this code"
          }
        }
      }
    },
    "/v1/clients": {
      "get": {
        "tags": [
          "Clients"
        ],
        "summary": "Own traveller card",
        "description": "Without an id returns the caller's own traveller card — the same card as `travelerId` in `GET /v1/user/me`, with names as in the passport, `docs[]` and `memberships[]`. 404 when the caller has no card.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Client profile (same shape as `GET /v1/clients/{id}`)."
          },
          "404": {
            "description": "No own traveller card."
          }
        },
        "operationId": "getOwnClient"
      }
    },
    "/v1/off-platform-bookings/{id}": {
      "patch": {
        "tags": [
          "Off-platform bookings"
        ],
        "summary": "Update an off-platform booking",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "description": "Change dates, price, details or the linked trip — for example after the traveller changed the booking with the supplier.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OffPlatformBookingUpdateRequest"
              },
              "example": {
                "dates": {
                  "from": "2026-12-15",
                  "to": "2026-12-17"
                },
                "total_price": 830
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The booking",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OffPlatformBooking"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token"
          },
          "403": {
            "description": "The booking or traveller belongs to another company"
          },
          "404": {
            "description": "No booking with this id"
          },
          "422": {
            "description": "Validation error"
          }
        }
      },
      "delete": {
        "tags": [
          "Off-platform bookings"
        ],
        "summary": "Delete an off-platform booking",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "description": "Removes the booking for good, for example when it was sent by mistake. A booking cancelled with the supplier is better kept and updated.",
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token"
          },
          "403": {
            "description": "The booking or traveller belongs to another company"
          },
          "404": {
            "description": "No booking with this id"
          }
        }
      }
    },
    "/v1/off-platform-bookings/{id}/attachments": {
      "post": {
        "tags": [
          "Off-platform bookings"
        ],
        "summary": "Attach confirmation files",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "description": "Up to 3 files per booking: PDF, JPG, PNG, WEBP or TXT, 20 MB each. Send `multipart/form-data` with the files in `files[]` (or one file in `file`).",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "files[]": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "binary"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The booking",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OffPlatformBooking"
                }
              }
            }
          },
          "400": {
            "description": "No file, unsupported type, too large, or more than 3 files on the booking"
          },
          "401": {
            "description": "Missing or invalid bearer token"
          },
          "403": {
            "description": "The booking or traveller belongs to another company"
          },
          "404": {
            "description": "No booking with this id"
          }
        }
      }
    },
    "/v1/events": {
      "get": {
        "tags": [
          "Company Events"
        ],
        "summary": "List events",
        "description": "Events the caller is a member of, plus all events of the companies they manage (staff: all).",
        "operationId": "companyEventsList",
        "parameters": [
          {
            "name": "tab",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "upcoming",
                "past",
                "drafts"
              ]
            },
            "description": "upcoming: open or in progress and not over, soonest first; past: over, or completed/closed/cancelled, latest first; drafts: drafts whatever the dates."
          },
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Text in the event name or city."
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "draft",
                "open",
                "in_progress",
                "completed",
                "closed",
                "cancelled"
              ]
            }
          },
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "offsite",
                "sko",
                "conference",
                "retreat",
                "incentive",
                "other"
              ]
            }
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Events ending on or after this date."
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Events starting on or before this date."
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 1,
              "minimum": 1
            }
          },
          {
            "name": "perPage",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 20,
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyEventList"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/EventsUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EventsForbidden"
          },
          "422": {
            "$ref": "#/components/responses/EventsValidationError"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "post": {
        "tags": [
          "Company Events"
        ],
        "summary": "Create an event",
        "description": "Creates a draft; the caller becomes its owner. Allowed for DIRECTOR, TRAVEL_MANAGER, admin roles and employees with the event organizer flag; never for guests. `403` also for a `companyId` the caller may not create in.",
        "operationId": "companyEventsCreate",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyEventCreateInput"
              },
              "example": {
                "name": "Lisbon offsite 2026",
                "type": "offsite",
                "locationName": "Lisbon, Portugal",
                "startDate": "2026-12-08",
                "endDate": "2026-12-11",
                "targetParticipants": 40,
                "budgetAmount": 25000,
                "budgetCurrency": "EUR"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyEvent"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/EventsUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EventsForbidden"
          },
          "422": {
            "$ref": "#/components/responses/EventsValidationError"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/events/context": {
      "get": {
        "tags": [
          "Company Events"
        ],
        "summary": "Current event context",
        "description": "The event the caller books in; `event` is null when there is none or it is no longer active. While a context is active, search endpoints refuse a service the event leaves out with 403 (code 6), and hotel stream rows carry `giataId` (catalog id) and `eventRecommended` (the event's recommended hotels, pinned first). See docs/rest/company-events.md, Search inside the context.",
        "operationId": "companyEventsContextGet",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyEventContext"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/EventsUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EventsForbidden"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "delete": {
        "tags": [
          "Company Events"
        ],
        "summary": "Leave the event context",
        "description": "Back to the caller own policy. Idempotent.",
        "operationId": "companyEventsContextLeave",
        "responses": {
          "204": {
            "description": "No content"
          },
          "401": {
            "$ref": "#/components/responses/EventsUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EventsForbidden"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/events/selectable": {
      "get": {
        "tags": [
          "Company Events"
        ],
        "summary": "Events an expense may be charged to",
        "description": "The events the caller may charge their own expense to (the `eventId` field of POST/PUT /expenses): a member who did not decline, an event of their current company, not closed or cancelled, Events module on. defaultId is the active booking context, which a new expense takes when it sends no eventId. On the expense, an eventId outside this rule is a 422 on `eventId`; null clears it.",
        "operationId": "companyEventsSelectable",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyEventSelectable"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/EventsUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EventsForbidden"
          }
        }
      }
    },
    "/v1/events/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/EventId"
        }
      ],
      "get": {
        "tags": [
          "Company Events"
        ],
        "summary": "Get an event",
        "description": "Any member, the company managers of the event company and staff.",
        "operationId": "companyEventsGet",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyEvent"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/EventsUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EventsForbidden"
          },
          "404": {
            "$ref": "#/components/responses/EventsNotFound"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "put": {
        "tags": [
          "Company Events"
        ],
        "summary": "Edit an event",
        "description": "Partial edit of the event own fields. Needs edit (owner, company managers, staff).",
        "operationId": "companyEventsUpdate",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyEventUpdateInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyEvent"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/EventsUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EventsForbidden"
          },
          "404": {
            "$ref": "#/components/responses/EventsNotFound"
          },
          "422": {
            "$ref": "#/components/responses/EventsValidationError"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/events/{id}/blocks": {
      "parameters": [
        {
          "$ref": "#/components/parameters/EventId"
        }
      ],
      "get": {
        "tags": [
          "Company Events"
        ],
        "summary": "List room blocks",
        "description": "Any viewer of the event. Prices need budget_view; notes, shortlist, rooming list and order are for organizers and agents. Includes the draft shortlist and the caller's own room.",
        "operationId": "companyEventsBlocks",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyEventBlocks"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/EventsUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EventsForbidden"
          },
          "404": {
            "$ref": "#/components/responses/EventsNotFound"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "post": {
        "tags": [
          "Company Events"
        ],
        "summary": "Request a room block",
        "description": "Needs the blocks permission or the right to edit the event. Raises an event_block_request work item for our agents.",
        "operationId": "companyEventsBlockRequest",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyEventBlockRequestInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyEventBlock"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/EventsUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EventsForbidden"
          },
          "404": {
            "$ref": "#/components/responses/EventsNotFound"
          },
          "422": {
            "$ref": "#/components/responses/EventsValidationError"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/events/{id}/blocks/shortlist": {
      "parameters": [
        {
          "$ref": "#/components/parameters/EventId"
        }
      ],
      "post": {
        "tags": [
          "Company Events"
        ],
        "summary": "Shortlist a hotel",
        "description": "Adds a catalog hotel to the open request, or to the draft kept for the next one. Blocks permission or edit.",
        "operationId": "companyEventsBlockShortlistAdd",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "hotelId"
                ],
                "properties": {
                  "hotelId": {
                    "type": "integer",
                    "description": "Giata id."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyEventShortlist"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/EventsUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EventsForbidden"
          },
          "404": {
            "$ref": "#/components/responses/EventsNotFound"
          },
          "422": {
            "$ref": "#/components/responses/EventsValidationError"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/events/{id}/blocks/shortlist/{hotelId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/EventId"
        },
        {
          "name": "hotelId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "integer"
          },
          "description": "Giata id."
        }
      ],
      "delete": {
        "tags": [
          "Company Events"
        ],
        "summary": "Remove a shortlisted hotel",
        "description": "Blocks permission or edit.",
        "operationId": "companyEventsBlockShortlistRemove",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyEventShortlist"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/EventsUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EventsForbidden"
          },
          "404": {
            "$ref": "#/components/responses/EventsNotFound"
          },
          "422": {
            "$ref": "#/components/responses/EventsValidationError"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/events/{id}/blocks/{blockId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/EventId"
        },
        {
          "name": "blockId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "integer"
          },
          "description": "Room block id."
        }
      ],
      "get": {
        "tags": [
          "Company Events"
        ],
        "summary": "Get a room block",
        "description": "A viewer of the event (with the Events module), or an agent: our staff, or the admin of the partner storefront serving the event company.",
        "operationId": "companyEventsBlock",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyEventBlockDetail"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/EventsUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EventsForbidden"
          },
          "404": {
            "$ref": "#/components/responses/EventsNotFound"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/events/{id}/blocks/{blockId}/accept": {
      "parameters": [
        {
          "$ref": "#/components/parameters/EventId"
        },
        {
          "name": "blockId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "integer"
          },
          "description": "Room block id."
        }
      ],
      "post": {
        "tags": [
          "Company Events"
        ],
        "summary": "Accept an offer",
        "description": "Blocks permission or edit. The other offers stay on the block; an expired offer cannot be accepted.",
        "operationId": "companyEventsBlockAccept",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "offerId"
                ],
                "properties": {
                  "offerId": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyEventBlock"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/EventsUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EventsForbidden"
          },
          "404": {
            "$ref": "#/components/responses/EventsNotFound"
          },
          "422": {
            "$ref": "#/components/responses/EventsValidationError"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/events/{id}/blocks/{blockId}/cancel": {
      "parameters": [
        {
          "$ref": "#/components/parameters/EventId"
        },
        {
          "name": "blockId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "integer"
          },
          "description": "Room block id."
        }
      ],
      "post": {
        "tags": [
          "Company Events"
        ],
        "summary": "Cancel a room block",
        "description": "An organizer (blocks or edit) or an agent; a block not booked yet, on an event that is not cancelled or closed. Its work item closes.",
        "operationId": "companyEventsBlockCancel",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyEventBlock"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/EventsUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EventsForbidden"
          },
          "404": {
            "$ref": "#/components/responses/EventsNotFound"
          },
          "422": {
            "$ref": "#/components/responses/EventsValidationError"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/events/{id}/blocks/{blockId}/offers": {
      "parameters": [
        {
          "$ref": "#/components/parameters/EventId"
        },
        {
          "name": "blockId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "integer"
          },
          "description": "Room block id."
        }
      ],
      "post": {
        "tags": [
          "Company Events"
        ],
        "summary": "Add a hotel offer",
        "description": "Agents only (others get 404). The first offer moves the block to offers_ready. Refused once an offer is accepted, and on a cancelled or closed event.",
        "operationId": "companyEventsBlockAddOffer",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyEventBlockOfferInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyEventBlock"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/EventsUnauthorized"
          },
          "404": {
            "$ref": "#/components/responses/EventsNotFound"
          },
          "422": {
            "$ref": "#/components/responses/EventsValidationError"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/events/{id}/blocks/{blockId}/order": {
      "parameters": [
        {
          "$ref": "#/components/parameters/EventId"
        },
        {
          "name": "blockId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "integer"
          },
          "description": "Room block id."
        }
      ],
      "post": {
        "tags": [
          "Company Events"
        ],
        "summary": "Link the booked order",
        "description": "Agents only. The order is named by its public code (order.code, e.g. LK261210002) within the event company, or by its numeric id (orderId). It must belong to the event company, to no other event and to no other block of the event; it gets the event stamped on it. 422 errors come under `order`.",
        "operationId": "companyEventsBlockLinkOrder",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "order": {
                    "type": "string",
                    "description": "Public order code (or numeric id)."
                  },
                  "orderId": {
                    "type": "integer",
                    "description": "Numeric id, accepted as before."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyEventBlock"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/EventsUnauthorized"
          },
          "404": {
            "$ref": "#/components/responses/EventsNotFound"
          },
          "422": {
            "$ref": "#/components/responses/EventsValidationError"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/events/{id}/blocks/{blockId}/rooms/{roomNo}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/EventId"
        },
        {
          "name": "blockId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "integer"
          },
          "description": "Room block id."
        },
        {
          "name": "roomNo",
          "in": "path",
          "required": true,
          "schema": {
            "type": "integer"
          },
          "description": "1..rooms of the accepted offer."
        }
      ],
      "put": {
        "tags": [
          "Company Events"
        ],
        "summary": "Place participants in a room",
        "description": "Blocks permission or edit, once an offer is accepted and while the event is not cancelled or closed. Both people must be members of the event; a member holds at most one room per block. Both null clears the room. 422 errors come under `room`.",
        "operationId": "companyEventsBlockAssignRoom",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "memberId": {
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "sharedWithMemberId": {
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyEventBlock"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/EventsUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EventsForbidden"
          },
          "404": {
            "$ref": "#/components/responses/EventsNotFound"
          },
          "422": {
            "$ref": "#/components/responses/EventsValidationError"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/events/{id}/bookings": {
      "parameters": [
        {
          "$ref": "#/components/parameters/EventId"
        }
      ],
      "get": {
        "tags": [
          "Company Events"
        ],
        "summary": "List the bookings of an event",
        "description": "Reduced cards of the orders stamped with the event. Needs participants, book_for_others or budget_view, except with mine=1 (the caller's own bookings). Amounts need budget_view.",
        "operationId": "companyEventsBookings",
        "parameters": [
          {
            "name": "outOfWindow",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "1",
                "true",
                "yes"
              ]
            },
            "description": "Keep only bookings that left the travel window."
          },
          {
            "name": "mine",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "1",
                "true",
                "yes"
              ]
            },
            "description": "Only the bookings the caller travels on; open to anyone who sees the event."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyEventBookings"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/EventsUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EventsForbidden"
          },
          "404": {
            "$ref": "#/components/responses/EventsNotFound"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/events/{id}/budget": {
      "parameters": [
        {
          "$ref": "#/components/parameters/EventId"
        }
      ],
      "get": {
        "tags": [
          "Company Events"
        ],
        "summary": "Event budget and spend",
        "description": "Planned, booked, paid and spent money of the event in its budget currency (else the company currency) at today's rate, client prices only. booked = orders in new, prePayment or finish; paid = booked orders with payment status paid; spent = expenses with this eventId that are approved or pending. Cancelled orders and rejected, cancelled or unsettled expenses count nowhere. Needs budget_view (403); not visible is 404.",
        "operationId": "companyEventsBudget",
        "parameters": [
          {
            "name": "groupBy",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "category",
                "participant",
                "costCenter",
                "department"
              ],
              "default": "category"
            },
            "description": "Rows by category, participant, cost center or department; anything else is category."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyEventBudget"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/EventsUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EventsForbidden"
          },
          "404": {
            "$ref": "#/components/responses/EventsNotFound"
          }
        }
      }
    },
    "/v1/events/{id}/card-expenses": {
      "get": {
        "tags": [
          "Company Events"
        ],
        "summary": "My event card spend",
        "description": "A short list of the caller's own spend on their event cards for this event. Each payment is a standard expense: open, edit and attach a receipt with `GET`/`PUT /v1/expenses/{id}` and its receipt endpoint.",
        "operationId": "companyEventCardExpenses",
        "parameters": [
          {
            "$ref": "#/components/parameters/EventId"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "items"
                  ],
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/CompanyEventCardExpense"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/EventsUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EventsForbidden"
          },
          "404": {
            "$ref": "#/components/responses/EventsNotFound"
          }
        }
      }
    },
    "/v1/events/{id}/cards": {
      "get": {
        "tags": [
          "Company Events"
        ],
        "summary": "List event cards",
        "description": "The event's virtual cards that the caller may read. A card holder sees their own card. The owner, a co-organizer with the `book_for_others` right and the company's managers see every member's card and get the issuing defaults. Never returns the card number, expiry or CVV: the holder reveals them in the app.",
        "operationId": "companyEventCardsList",
        "parameters": [
          {
            "$ref": "#/components/parameters/EventId"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyEventCards"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/EventsUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EventsForbidden"
          },
          "404": {
            "$ref": "#/components/responses/EventsNotFound"
          }
        }
      }
    },
    "/v1/events/{id}/context": {
      "parameters": [
        {
          "$ref": "#/components/parameters/EventId"
        }
      ],
      "post": {
        "tags": [
          "Company Events"
        ],
        "summary": "Enter the event context",
        "description": "The caller starts booking within the event; its policy replaces their own. Requires an active participant: Events module on, event of the caller current company, status open or in_progress, invitation not declined, today not after window.departTo (else the event end).",
        "operationId": "companyEventsContextEnter",
        "responses": {
          "204": {
            "description": "No content"
          },
          "401": {
            "$ref": "#/components/responses/EventsUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EventsForbidden"
          },
          "404": {
            "$ref": "#/components/responses/EventsNotFound"
          },
          "422": {
            "$ref": "#/components/responses/EventsValidationError"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/events/{id}/members": {
      "parameters": [
        {
          "$ref": "#/components/parameters/EventId"
        }
      ],
      "get": {
        "tags": [
          "Company Events"
        ],
        "summary": "List members",
        "description": "Organizer team first, then participants. Any viewer of the event. Contacts need participants; estimate and actual need budget_view.",
        "operationId": "companyEventsMembers",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyEventMembers"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/EventsUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EventsForbidden"
          },
          "404": {
            "$ref": "#/components/responses/EventsNotFound"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "post": {
        "tags": [
          "Company Events"
        ],
        "summary": "Add employees",
        "description": "Needs participants. Adds employees of the event company as participants; one foreign id refuses the batch.",
        "operationId": "companyEventsMembersAdd",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyEventAddMembersInput"
              },
              "example": {
                "userIds": [
                  5120,
                  5121
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyEventMembers"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/EventsUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EventsForbidden"
          },
          "404": {
            "$ref": "#/components/responses/EventsNotFound"
          },
          "422": {
            "$ref": "#/components/responses/EventsValidationError"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/events/{id}/members/candidates": {
      "parameters": [
        {
          "$ref": "#/components/parameters/EventId"
        }
      ],
      "get": {
        "tags": [
          "Company Events"
        ],
        "summary": "Employees that can still be added",
        "description": "Needs participants. At most 30.",
        "operationId": "companyEventsCandidates",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Name or email search."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyEventCandidates"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/EventsUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EventsForbidden"
          },
          "404": {
            "$ref": "#/components/responses/EventsNotFound"
          },
          "422": {
            "$ref": "#/components/responses/EventsValidationError"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/events/{id}/members/check": {
      "parameters": [
        {
          "$ref": "#/components/parameters/EventId"
        }
      ],
      "post": {
        "tags": [
          "Company Events"
        ],
        "summary": "Preview a bulk invite",
        "description": "Needs participants. What inviting each address would do; changes nothing. Up to 500 addresses.",
        "operationId": "companyEventsCheckInvitees",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "emails": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "emails"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "email": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "colleague",
                              "guest",
                              "new_guest",
                              "in_event",
                              "other_account",
                              "archived",
                              "invalid"
                            ]
                          },
                          "name": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/EventsUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EventsForbidden"
          },
          "404": {
            "$ref": "#/components/responses/EventsNotFound"
          },
          "422": {
            "$ref": "#/components/responses/EventsValidationError"
          }
        }
      }
    },
    "/v1/events/{id}/members/guest": {
      "parameters": [
        {
          "$ref": "#/components/parameters/EventId"
        }
      ],
      "post": {
        "tags": [
          "Company Events"
        ],
        "summary": "Invite a person by email",
        "description": "Needs participants. An employee with that email joins as an employee; anyone else becomes (or reuses) a guest traveller of the company with sign-in enabled.",
        "operationId": "companyEventsInviteGuest",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyEventGuestInput"
              },
              "example": {
                "email": "guest@example.com",
                "firstNameEn": "John",
                "lastNameEn": "Smith"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyEventMember"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/EventsUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EventsForbidden"
          },
          "404": {
            "$ref": "#/components/responses/EventsNotFound"
          },
          "422": {
            "$ref": "#/components/responses/EventsValidationError"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/events/{id}/members/invite": {
      "parameters": [
        {
          "$ref": "#/components/parameters/EventId"
        }
      ],
      "post": {
        "tags": [
          "Company Events"
        ],
        "summary": "Mail the event link to members",
        "description": "Needs participants. Sets status invited (accepted stays accepted); the owner is skipped.",
        "operationId": "companyEventsSendInvites",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyEventInviteInput"
              },
              "example": {
                "memberIds": [
                  901,
                  902
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyEventMembers"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/EventsUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EventsForbidden"
          },
          "404": {
            "$ref": "#/components/responses/EventsNotFound"
          },
          "422": {
            "$ref": "#/components/responses/EventsValidationError"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/events/{id}/members/invite-preview": {
      "parameters": [
        {
          "$ref": "#/components/parameters/EventId"
        }
      ],
      "get": {
        "tags": [
          "Company Events"
        ],
        "summary": "The invitation letter as the caller would send it",
        "description": "Needs participants. Rendered by the letter's own template in the page language; the recipient's name is \"[name]\", the inviter is the caller, no sign-in line. Every value in html is escaped.",
        "operationId": "companyEventsInvitePreview",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "subject": {
                      "type": "string"
                    },
                    "html": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "subject",
                    "html"
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/EventsUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EventsForbidden"
          },
          "404": {
            "$ref": "#/components/responses/EventsNotFound"
          }
        }
      }
    },
    "/v1/events/{id}/members/{memberId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/EventId"
        },
        {
          "$ref": "#/components/parameters/MemberId"
        }
      ],
      "put": {
        "tags": [
          "Company Events"
        ],
        "summary": "Edit a member",
        "description": "departureCity and allowedServices need participants; estimate needs budget_view; role and permissions need edit. A member of another event is 404.",
        "operationId": "companyEventsMemberUpdate",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyEventMemberUpdateInput"
              },
              "example": {
                "departureCity": "Berlin",
                "allowedServices": {
                  "bus": false
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyEventMember"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/EventsUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EventsForbidden"
          },
          "404": {
            "$ref": "#/components/responses/EventsNotFound"
          },
          "422": {
            "$ref": "#/components/responses/EventsValidationError"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "delete": {
        "tags": [
          "Company Events"
        ],
        "summary": "Remove a member",
        "description": "A participant needs participants; a co-organizer needs edit. The owner cannot be removed (422).",
        "operationId": "companyEventsMemberRemove",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "deleted": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/EventsUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EventsForbidden"
          },
          "404": {
            "$ref": "#/components/responses/EventsNotFound"
          },
          "422": {
            "$ref": "#/components/responses/EventsValidationError"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/events/{id}/members/{memberId}/card": {
      "post": {
        "tags": [
          "Company Events"
        ],
        "summary": "Issue a member's event card",
        "description": "Issues a virtual card to the participant for spend at the event. The caller needs the event-card right (owner, co-organizer with `book_for_others`, company manager), the company needs Travel Code cards (`available` in `GET /v1/events/{id}/cards`), and the participant must pay with event cards: `settings.payment.mode` = `event_card`, or the member's own `paymentMode` = `event_card` (`PUT /v1/events/{id}/members/{memberId}`). Every field is optional: what is left out comes from `settings.payment.card`. A limit in another currency is converted to the card account's currency, so `limit.currency` in the answer can differ from the request.",
        "operationId": "companyEventCardIssue",
        "parameters": [
          {
            "$ref": "#/components/parameters/EventId"
          },
          {
            "$ref": "#/components/parameters/MemberId"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyEventCardIssueInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The card was issued.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "card"
                  ],
                  "properties": {
                    "card": {
                      "$ref": "#/components/schemas/CompanyEventCard"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/EventsUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EventsForbidden"
          },
          "404": {
            "$ref": "#/components/responses/EventsNotFound"
          },
          "422": {
            "$ref": "#/components/responses/EventsValidationError"
          }
        }
      },
      "delete": {
        "tags": [
          "Company Events"
        ],
        "summary": "Close a member's event card",
        "description": "Closes the participant's open event card at the issuer. Its spend history is kept. Staff may close but never issue.",
        "operationId": "companyEventCardClose",
        "parameters": [
          {
            "$ref": "#/components/parameters/EventId"
          },
          {
            "$ref": "#/components/parameters/MemberId"
          }
        ],
        "responses": {
          "200": {
            "description": "`closed` is how many of the member's cards this call closed (0 when none was open).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "closed"
                  ],
                  "properties": {
                    "closed": {
                      "type": "integer",
                      "minimum": 0
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/EventsUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EventsForbidden"
          },
          "404": {
            "$ref": "#/components/responses/EventsNotFound"
          },
          "422": {
            "$ref": "#/components/responses/EventsValidationError"
          }
        }
      }
    },
    "/v1/events/{id}/respond": {
      "parameters": [
        {
          "$ref": "#/components/parameters/EventId"
        }
      ],
      "post": {
        "tags": [
          "Company Events"
        ],
        "summary": "Answer your own invitation",
        "description": "The caller must be a member (403 otherwise) and not the owner (422).",
        "operationId": "companyEventsRespond",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyEventRespondInput"
              },
              "example": {
                "accept": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyEventMember"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/EventsUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EventsForbidden"
          },
          "404": {
            "$ref": "#/components/responses/EventsNotFound"
          },
          "422": {
            "$ref": "#/components/responses/EventsValidationError"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/events/{id}/settings": {
      "parameters": [
        {
          "$ref": "#/components/parameters/EventId"
        }
      ],
      "get": {
        "tags": [
          "Company Events"
        ],
        "summary": "Get booking settings and the event policy",
        "description": "Needs edit.",
        "operationId": "companyEventsSettingsGet",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyEventSettings"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/EventsUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EventsForbidden"
          },
          "404": {
            "$ref": "#/components/responses/EventsNotFound"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "put": {
        "tags": [
          "Company Events"
        ],
        "summary": "Save booking settings and the event policy",
        "description": "Needs edit. What is not sent stays. Never touches bookings already made. 422 on a frozen event (`event`) and per settings path.",
        "operationId": "companyEventsSettingsUpdate",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyEventSettingsUpdate"
              },
              "example": {
                "settings": {
                  "window": {
                    "arriveFrom": "2026-12-07",
                    "arriveTo": "2026-12-08",
                    "departFrom": "2026-12-11",
                    "departTo": "2026-12-12",
                    "action": "approval"
                  },
                  "services": {
                    "bus": false
                  },
                  "flight": {
                    "maxCabin": "economy",
                    "arrivalAirports": [
                      "LIS"
                    ]
                  },
                  "hotel": {
                    "mode": "whitelist",
                    "hotelIds": [
                      1234567
                    ]
                  },
                  "approval": "threshold",
                  "approvalThreshold": {
                    "amount": 500,
                    "currency": "EUR"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyEventSettings"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/EventsUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EventsForbidden"
          },
          "404": {
            "$ref": "#/components/responses/EventsNotFound"
          },
          "422": {
            "$ref": "#/components/responses/EventsValidationError"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/events/{id}/status": {
      "parameters": [
        {
          "$ref": "#/components/parameters/EventId"
        }
      ],
      "post": {
        "tags": [
          "Company Events"
        ],
        "summary": "Change the event status",
        "description": "Needs edit. draft -> open|cancelled; open -> in_progress|cancelled; in_progress -> completed; completed -> closed. 422 on `status` for an unknown value or a forbidden transition.",
        "operationId": "companyEventsStatus",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyEventStatusInput"
              },
              "example": {
                "status": "open"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyEvent"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/EventsUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EventsForbidden"
          },
          "404": {
            "$ref": "#/components/responses/EventsNotFound"
          },
          "422": {
            "$ref": "#/components/responses/EventsValidationError"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/search/buses": {
      "post": {
        "tags": [
          "Bus, Ferry & Tram Search"
        ],
        "summary": "Kick off bus search",
        "description": "Starts an asynchronous bus search and returns a `cacheId` to poll. The request contract is shared by buses, ferries and trams (and `POST /v1/search/trains`).\n\nAccepts a JWT, an API token or an OAuth access token (`Authorization: Bearer`; no OAuth scope needed). Counts against the account's search allowance: over the per-minute limit `429` code `135`, over the daily limit `429` code `136` (with `Retry-After`). The company's bus module must be on (`403`, code `130`).\n\nError bodies carry the numeric `code`; `message` starts with `[code]`.",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "Every key in `required` must be present in the body, even when it is empty (a missing key answers `400`, code `4`). For a one-way search send `dateTo` and `timeReturn` as `\"\"` and `service` as `[]`.",
                "required": [
                  "route",
                  "locationFrom",
                  "locationTo",
                  "date",
                  "timeTo",
                  "dateTo",
                  "timeReturn",
                  "adults",
                  "children",
                  "guests",
                  "service"
                ],
                "properties": {
                  "route": {
                    "type": "integer",
                    "enum": [
                      1,
                      2
                    ],
                    "default": 1,
                    "description": "1 one-way, 2 round trip."
                  },
                  "locationFrom": {
                    "type": "string",
                    "description": "Departure station **id** (numeric string) from `GET /v1/data/transport-stations?transportType=BUS`. An unknown id answers `404`, code `12`."
                  },
                  "locationTo": {
                    "type": "string",
                    "description": "Arrival station id, same source."
                  },
                  "date": {
                    "type": "string",
                    "example": "18.12.2026",
                    "description": "Outbound date `DD.MM.YYYY`, today or later."
                  },
                  "timeTo": {
                    "type": "string",
                    "example": "08:00",
                    "description": "Earliest outbound departure `HH:MM`. Must not be empty."
                  },
                  "dateTo": {
                    "type": "string",
                    "description": "Return date `DD.MM.YYYY`, not before `date`. Required (non-empty) when `route` = 2, otherwise `\"\"`."
                  },
                  "timeReturn": {
                    "type": "string",
                    "description": "Earliest return departure `HH:MM`. Required (non-empty) when `route` = 2, otherwise `\"\"`."
                  },
                  "adults": {
                    "type": "integer",
                    "description": "Must be present; the count comes from `guests`."
                  },
                  "children": {
                    "type": "integer",
                    "description": "Must be present; the count comes from `guests`."
                  },
                  "guests": {
                    "type": "array",
                    "description": "Who travels. The passenger count is read from here only: the top-level `adults` / `children` fields are ignored. Send one entry. Total passengers (adults + seniors + children) must be 1-9.",
                    "items": {
                      "type": "object",
                      "required": [
                        "adults"
                      ],
                      "properties": {
                        "adults": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "seniors": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Passengers aged 60+."
                        },
                        "children": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "childrenAges": {
                          "type": "array",
                          "items": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 17
                          },
                          "description": "One age per child. The number of children is counted from this list."
                        }
                      }
                    },
                    "example": [
                      {
                        "adults": 2,
                        "seniors": 0,
                        "children": 1,
                        "childrenAges": [
                          7
                        ]
                      }
                    ]
                  },
                  "cabinClass": {
                    "type": "string",
                    "enum": [
                      "economy",
                      "business",
                      "first"
                    ],
                    "default": "economy"
                  },
                  "service": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Supplier filter. Honoured for Travel Code staff only and ignored for every other caller; send `[]`."
                  },
                  "currency": {
                    "type": "string",
                    "description": "Optional ISO-3 currency for the prices of this search (one of the supported currencies, otherwise `400`, code `22`). Defaults to the account currency."
                  }
                }
              },
              "example": {
                "route": 1,
                "locationFrom": "8728",
                "locationTo": "9113",
                "date": "18.12.2026",
                "timeTo": "06:00",
                "dateTo": "",
                "timeReturn": "",
                "adults": 1,
                "children": 0,
                "guests": [
                  {
                    "adults": 1,
                    "children": 0,
                    "childrenAges": []
                  }
                ],
                "service": []
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Search started.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "cacheId": {
                      "type": "string",
                      "description": "Search id. Poll `GET .../{cacheId}`; results are kept for 1 hour."
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "progress",
                        "success",
                        "success_partially",
                        "failed"
                      ]
                    },
                    "completed": {
                      "type": "boolean",
                      "description": "`true` once every supplier has answered (`success`, `success_partially` or `failed`)."
                    },
                    "transportType": {
                      "type": "string",
                      "enum": [
                        "BUS",
                        "FERRY",
                        "TRAM"
                      ]
                    },
                    "countServices": {
                      "type": "integer",
                      "description": "Suppliers queried."
                    },
                    "countFinishedServices": {
                      "type": "integer"
                    },
                    "countFailedServices": {
                      "type": "integer"
                    },
                    "count": {
                      "type": "integer",
                      "description": "Results already in (usually 0 right after the start)."
                    },
                    "errors": {
                      "type": "array",
                      "items": {}
                    },
                    "warnings": {
                      "type": "array",
                      "items": {}
                    }
                  }
                },
                "example": {
                  "status": "pending",
                  "errors": [],
                  "warnings": [],
                  "cacheId": "Xk3vQ9...",
                  "transportType": "BUS",
                  "countServices": 1,
                  "countFinishedServices": 0,
                  "countFailedServices": 0,
                  "count": 0,
                  "completed": false
                }
              }
            }
          },
          "400": {
            "description": "Code `4`: a required key is missing. Code `11`: validation failed (empty time, past date, return before outbound, passengers not 1-9...). Code `18`: `date`/`dateTo` is not a real `DD.MM.YYYY` date. Code `19`: unknown `service` value. Code `22`: unsupported `currency`."
          },
          "401": {
            "description": "Code `13`: no token. Code `14`: token invalid or expired."
          },
          "403": {
            "description": "Code `141`: the company turned off booking by guest travellers. Code `130`: the bus module is turned off for the company. Code `6`: the traveller's company event does not include buses."
          },
          "404": {
            "description": "Code `12`: station id not found."
          },
          "429": {
            "description": "Code `135` / `136`: search allowance spent (see `Retry-After`). Code `140`: daily limit of the free OAuth plan."
          }
        }
      }
    },
    "/v1/search/buses/{cacheId}": {
      "get": {
        "tags": [
          "Bus, Ferry & Tram Search"
        ],
        "summary": "Read bus search result",
        "description": "Results of a bus, ferry or tram search, filtered, sorted and paged. Poll until `status` is final; results stay readable for 1 hour after the start.\n\nThe bus, ferry, tram (and train) result endpoints are one shared reader keyed by `cacheId`, so any of them returns the search a `cacheId` belongs to; use the one that matches the search.\n\nPrices are the client's (`totalPrice` includes the Travel Code `serviceFee`). The supplier name (`serviceType`), net prices (`adminPrices`) and supplier fare fields are returned only to Travel Code staff signed in with a JWT or OAuth token, never to API-token callers.\n\nTo book: `POST /v1/cart/trains` with `sessionId` = `cacheId`, `itemId` = `items[].id`, `offers` = `items[].offers[].id`.\n\nError bodies carry the numeric `code`; `message` starts with `[code]`.",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": []
          }
        ],
        "parameters": [
          {
            "name": "cacheId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "`cacheId` from the POST."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 25
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 0
            }
          },
          {
            "name": "sort",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "price",
                "fast",
                "departure"
              ]
            },
            "description": "Ascending. Without it results keep the supplier order."
          },
          {
            "name": "embedded",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Comma-separated: `carriers`, `filters`."
          },
          {
            "name": "filter",
            "in": "query",
            "style": "deepObject",
            "explode": true,
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            },
            "description": "Optional filters as `filter[<key>]=<value>`:\n- `departureMin` / `departureMax`, `departureReturnMin` / `departureReturnMax`: minutes after midnight, station local time (`480` = 08:00).\n- `durationMin` / `durationMax`: minutes.\n- `transfer` / `transferReturn`: number of changes `0`, `1`, `2`, or `3` (= 3 or more); `all` = no filter.\n- `carrier`: carrier codes, comma-separated.\n- `trainNumber`: service number (spaces and case ignored).\n- `wifi`: `true` for Wi-Fi only.\n- `minprice` / `maxprice`: compared with the supplier's own fare before Travel Code fees, in the supplier currency, so it may not match `price.totalPrice`.\n- `leg` (`outbound` / `return`) and `outboundId`: two-step round-trip view. `leg=outbound` lists each outbound departure once (its cheapest pair) with `returnOptions`; `leg=return&outboundId=<outbound id>` lists the pairs of that departure."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "cacheId": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "progress",
                        "success",
                        "success_partially",
                        "failed"
                      ],
                      "description": "Poll until it is not `pending`/`progress`."
                    },
                    "transportType": {
                      "type": "string",
                      "description": "Type the search was started for."
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true,
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Send as `itemId` to `POST /v1/cart/trains`. A round trip is cached as outbound x return pairs: `<outboundId>_RT_<inboundId>`."
                          },
                          "vehicleType": {
                            "type": "string",
                            "enum": [
                              "BUS",
                              "FERRY",
                              "TRAM",
                              "TRAIN"
                            ]
                          },
                          "origin": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "type": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "localLabel": {
                                "type": "string"
                              },
                              "timezone": {
                                "type": "string"
                              }
                            }
                          },
                          "destination": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "type": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "localLabel": {
                                "type": "string"
                              },
                              "timezone": {
                                "type": "string"
                              }
                            }
                          },
                          "departure": {
                            "type": "string",
                            "description": "Local time with offset, ISO-8601."
                          },
                          "arrival": {
                            "type": "string"
                          },
                          "duration": {
                            "type": "integer",
                            "description": "Minutes."
                          },
                          "connectionDuration": {
                            "type": "integer",
                            "description": "Minutes spent on changes."
                          },
                          "itineraries": {
                            "type": "array",
                            "description": "One per direction: `segments[]` (origin, destination, departure, arrival, duration, operationCarrier, marketingCarrier, vehicle), `segmentConnections[]`, `transfers`.",
                            "items": {
                              "type": "object"
                            }
                          },
                          "offers": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "description": "A fare of the result. Supplier and net price fields (`originalPrice`, `convertedPrice`, the price breakdown) are returned to Travel Code staff only.",
                              "additionalProperties": true,
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "description": "Send as `offers` to `POST /v1/cart/trains`."
                                },
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "outbound",
                                    "inbound"
                                  ]
                                },
                                "expiredAt": {
                                  "type": "integer",
                                  "description": "Unix time after which the fare cannot be added to the cart."
                                },
                                "price": {
                                  "type": [
                                    "object",
                                    "null"
                                  ],
                                  "description": "What the client pays.",
                                  "properties": {
                                    "totalPrice": {
                                      "type": "number"
                                    },
                                    "serviceFee": {
                                      "type": "number",
                                      "description": "Travel Code service fee included in `totalPrice`."
                                    },
                                    "currency": {
                                      "type": "string"
                                    }
                                  }
                                },
                                "comfortCategory": {
                                  "type": "object",
                                  "description": "Fare class label (e.g. standard / first)."
                                },
                                "flexibility": {
                                  "type": "object",
                                  "description": "Exchange/refund flexibility label."
                                },
                                "fare": {
                                  "type": "object",
                                  "description": "Fare conditions (`conditions` text, labels)."
                                },
                                "fares": {
                                  "type": "array",
                                  "items": {
                                    "type": "object"
                                  },
                                  "description": "Per-segment fares of a multi-fare offer."
                                },
                                "seatsLeft": {
                                  "type": [
                                    "integer",
                                    "null"
                                  ]
                                },
                                "outOfPolicy": {
                                  "type": "boolean",
                                  "description": "The fare breaks the caller's travel policy; it books only after approval."
                                },
                                "outOfPolicyReasons": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "hasSeatReservations": {
                                  "type": "boolean"
                                },
                                "availableServices": {
                                  "type": "array",
                                  "items": {}
                                }
                              }
                            }
                          },
                          "lowestPrice": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "description": "What the client pays.",
                            "properties": {
                              "totalPrice": {
                                "type": "number"
                              },
                              "serviceFee": {
                                "type": "number",
                                "description": "Travel Code service fee included in `totalPrice`."
                              },
                              "currency": {
                                "type": "string"
                              }
                            }
                          },
                          "nonRefundable": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "description": "Cheaper non-refundable fares of the same journey: `{offers[], lowestPrice}`. To book one, send its offer id and `nonRefundable: true` to the cart."
                          },
                          "operatingCarriers": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            },
                            "description": "Carrier codes; names and logos come with `embedded=carriers`."
                          },
                          "wifi": {
                            "type": "boolean"
                          },
                          "supportsSeats": {
                            "type": "boolean",
                            "description": "Seats can be chosen for this departure in the cart."
                          },
                          "fullRouteAvailable": {
                            "type": "boolean"
                          },
                          "co2": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "description": "`{kgPerPax, kgTotal, qualityTier}` estimate."
                          },
                          "returnOptions": {
                            "type": "integer",
                            "description": "Only with `filter[leg]=outbound`: how many return options the outbound departure has."
                          }
                        }
                      }
                    },
                    "total": {
                      "type": "integer",
                      "description": "Results after filters, before paging."
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "offset": {
                      "type": "integer"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "currencySign": {
                      "type": "string"
                    },
                    "warnings": {
                      "type": "array",
                      "description": "Supplier notices shown to the traveller (no answer from a supplier, date outside the sales window...).",
                      "items": {
                        "type": "object",
                        "properties": {
                          "code": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "policyHidesOffers": {
                      "type": "boolean",
                      "description": "Present when the travel policy hides out-of-policy results."
                    },
                    "policyTotalFound": {
                      "type": "integer",
                      "description": "Results found before the policy filter (with `policyHidesOffers`)."
                    },
                    "policyHiddenCount": {
                      "type": "integer"
                    },
                    "carriers": {
                      "type": "object",
                      "description": "With `embedded=carriers`: `{<carrierCode>: {name, logo}}`.",
                      "additionalProperties": {
                        "type": "object"
                      }
                    },
                    "filters": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "With `embedded=filters`: the accepted `filter[...]` keys."
                    }
                  }
                },
                "example": {
                  "cacheId": "Xk3vQ9...",
                  "status": "success",
                  "transportType": "BUS",
                  "items": [
                    {
                      "id": "2f9c1a...",
                      "vehicleType": "BUS",
                      "origin": {
                        "id": "8728",
                        "code": "DEBER",
                        "label": "Berlin Central Bus Station",
                        "timezone": "Europe/Berlin"
                      },
                      "destination": {
                        "id": "9113",
                        "code": "CZPRG",
                        "label": "Prague Florenc",
                        "timezone": "Europe/Prague"
                      },
                      "departure": "2026-12-18T08:15:00+01:00",
                      "arrival": "2026-12-18T12:40:00+01:00",
                      "duration": 265,
                      "offers": [
                        {
                          "id": "a1b2c3",
                          "type": "outbound",
                          "price": {
                            "totalPrice": 31.4,
                            "serviceFee": 2.0,
                            "currency": "EUR"
                          },
                          "outOfPolicy": false
                        }
                      ],
                      "lowestPrice": {
                        "totalPrice": 31.4,
                        "serviceFee": 2.0,
                        "currency": "EUR"
                      },
                      "operatingCarriers": [
                        "FLIX"
                      ],
                      "supportsSeats": false
                    }
                  ],
                  "total": 14,
                  "limit": 25,
                  "offset": 0,
                  "currency": "EUR",
                  "currencySign": "€",
                  "warnings": []
                }
              }
            }
          },
          "401": {
            "description": "Code `13` / `14`: no token, or token invalid."
          },
          "404": {
            "description": "Code `10`: unknown or expired `cacheId` - start a new search."
          }
        }
      }
    },
    "/v1/search/ferries": {
      "post": {
        "tags": [
          "Bus, Ferry & Tram Search"
        ],
        "summary": "Kick off ferry search",
        "description": "Starts an asynchronous ferry search and returns a `cacheId` to poll. The request contract is shared by buses, ferries and trams (and `POST /v1/search/trains`).\n\nAccepts a JWT, an API token or an OAuth access token (`Authorization: Bearer`; no OAuth scope needed). Counts against the account's search allowance: over the per-minute limit `429` code `135`, over the daily limit `429` code `136` (with `Retry-After`).\n\nError bodies carry the numeric `code`; `message` starts with `[code]`.",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "Every key in `required` must be present in the body, even when it is empty (a missing key answers `400`, code `4`). For a one-way search send `dateTo` and `timeReturn` as `\"\"` and `service` as `[]`.",
                "required": [
                  "route",
                  "locationFrom",
                  "locationTo",
                  "date",
                  "timeTo",
                  "dateTo",
                  "timeReturn",
                  "adults",
                  "children",
                  "guests",
                  "service"
                ],
                "properties": {
                  "route": {
                    "type": "integer",
                    "enum": [
                      1,
                      2
                    ],
                    "default": 1,
                    "description": "1 one-way, 2 round trip."
                  },
                  "locationFrom": {
                    "type": "string",
                    "description": "Departure station **id** (numeric string) from `GET /v1/data/transport-stations?transportType=FERRY`. An unknown id answers `404`, code `12`."
                  },
                  "locationTo": {
                    "type": "string",
                    "description": "Arrival station id, same source."
                  },
                  "date": {
                    "type": "string",
                    "example": "18.12.2026",
                    "description": "Outbound date `DD.MM.YYYY`, today or later."
                  },
                  "timeTo": {
                    "type": "string",
                    "example": "08:00",
                    "description": "Earliest outbound departure `HH:MM`. Must not be empty."
                  },
                  "dateTo": {
                    "type": "string",
                    "description": "Return date `DD.MM.YYYY`, not before `date`. Required (non-empty) when `route` = 2, otherwise `\"\"`."
                  },
                  "timeReturn": {
                    "type": "string",
                    "description": "Earliest return departure `HH:MM`. Required (non-empty) when `route` = 2, otherwise `\"\"`."
                  },
                  "adults": {
                    "type": "integer",
                    "description": "Must be present; the count comes from `guests`."
                  },
                  "children": {
                    "type": "integer",
                    "description": "Must be present; the count comes from `guests`."
                  },
                  "guests": {
                    "type": "array",
                    "description": "Who travels. The passenger count is read from here only: the top-level `adults` / `children` fields are ignored. Send one entry. Total passengers (adults + seniors + children) must be 1-9.",
                    "items": {
                      "type": "object",
                      "required": [
                        "adults"
                      ],
                      "properties": {
                        "adults": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "seniors": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Passengers aged 60+."
                        },
                        "children": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "childrenAges": {
                          "type": "array",
                          "items": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 17
                          },
                          "description": "One age per child. The number of children is counted from this list."
                        }
                      }
                    },
                    "example": [
                      {
                        "adults": 2,
                        "seniors": 0,
                        "children": 1,
                        "childrenAges": [
                          7
                        ]
                      }
                    ]
                  },
                  "cabinClass": {
                    "type": "string",
                    "enum": [
                      "economy",
                      "business",
                      "first"
                    ],
                    "default": "economy"
                  },
                  "service": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Supplier filter. Honoured for Travel Code staff only and ignored for every other caller; send `[]`."
                  },
                  "currency": {
                    "type": "string",
                    "description": "Optional ISO-3 currency for the prices of this search (one of the supported currencies, otherwise `400`, code `22`). Defaults to the account currency."
                  }
                }
              },
              "example": {
                "route": 1,
                "locationFrom": "8728",
                "locationTo": "9113",
                "date": "18.12.2026",
                "timeTo": "06:00",
                "dateTo": "",
                "timeReturn": "",
                "adults": 1,
                "children": 0,
                "guests": [
                  {
                    "adults": 1,
                    "children": 0,
                    "childrenAges": []
                  }
                ],
                "service": []
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Search started.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "cacheId": {
                      "type": "string",
                      "description": "Search id. Poll `GET .../{cacheId}`; results are kept for 1 hour."
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "progress",
                        "success",
                        "success_partially",
                        "failed"
                      ]
                    },
                    "completed": {
                      "type": "boolean",
                      "description": "`true` once every supplier has answered (`success`, `success_partially` or `failed`)."
                    },
                    "transportType": {
                      "type": "string",
                      "enum": [
                        "BUS",
                        "FERRY",
                        "TRAM"
                      ]
                    },
                    "countServices": {
                      "type": "integer",
                      "description": "Suppliers queried."
                    },
                    "countFinishedServices": {
                      "type": "integer"
                    },
                    "countFailedServices": {
                      "type": "integer"
                    },
                    "count": {
                      "type": "integer",
                      "description": "Results already in (usually 0 right after the start)."
                    },
                    "errors": {
                      "type": "array",
                      "items": {}
                    },
                    "warnings": {
                      "type": "array",
                      "items": {}
                    }
                  }
                },
                "example": {
                  "status": "pending",
                  "errors": [],
                  "warnings": [],
                  "cacheId": "Xk3vQ9...",
                  "transportType": "FERRY",
                  "countServices": 1,
                  "countFinishedServices": 0,
                  "countFailedServices": 0,
                  "count": 0,
                  "completed": false
                }
              }
            }
          },
          "400": {
            "description": "Code `4`: a required key is missing. Code `11`: validation failed (empty time, past date, return before outbound, passengers not 1-9...). Code `18`: `date`/`dateTo` is not a real `DD.MM.YYYY` date. Code `19`: unknown `service` value. Code `22`: unsupported `currency`."
          },
          "401": {
            "description": "Code `13`: no token. Code `14`: token invalid or expired."
          },
          "403": {
            "description": "Code `141`: the company turned off booking by guest travellers."
          },
          "404": {
            "description": "Code `12`: station id not found."
          },
          "429": {
            "description": "Code `135` / `136`: search allowance spent (see `Retry-After`). Code `140`: daily limit of the free OAuth plan."
          }
        }
      }
    },
    "/v1/search/ferries/{cacheId}": {
      "get": {
        "tags": [
          "Bus, Ferry & Tram Search"
        ],
        "summary": "Read ferry search result",
        "description": "Results of a bus, ferry or tram search, filtered, sorted and paged. Poll until `status` is final; results stay readable for 1 hour after the start.\n\nThe bus, ferry, tram (and train) result endpoints are one shared reader keyed by `cacheId`, so any of them returns the search a `cacheId` belongs to; use the one that matches the search.\n\nPrices are the client's (`totalPrice` includes the Travel Code `serviceFee`). The supplier name (`serviceType`), net prices (`adminPrices`) and supplier fare fields are returned only to Travel Code staff signed in with a JWT or OAuth token, never to API-token callers.\n\nTo book: `POST /v1/cart/trains` with `sessionId` = `cacheId`, `itemId` = `items[].id`, `offers` = `items[].offers[].id`.\n\nError bodies carry the numeric `code`; `message` starts with `[code]`.",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": []
          }
        ],
        "parameters": [
          {
            "name": "cacheId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "`cacheId` from the POST."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 25
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 0
            }
          },
          {
            "name": "sort",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "price",
                "fast",
                "departure"
              ]
            },
            "description": "Ascending. Without it results keep the supplier order."
          },
          {
            "name": "embedded",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Comma-separated: `carriers`, `filters`."
          },
          {
            "name": "filter",
            "in": "query",
            "style": "deepObject",
            "explode": true,
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            },
            "description": "Optional filters as `filter[<key>]=<value>`:\n- `departureMin` / `departureMax`, `departureReturnMin` / `departureReturnMax`: minutes after midnight, station local time (`480` = 08:00).\n- `durationMin` / `durationMax`: minutes.\n- `transfer` / `transferReturn`: number of changes `0`, `1`, `2`, or `3` (= 3 or more); `all` = no filter.\n- `carrier`: carrier codes, comma-separated.\n- `trainNumber`: service number (spaces and case ignored).\n- `wifi`: `true` for Wi-Fi only.\n- `minprice` / `maxprice`: compared with the supplier's own fare before Travel Code fees, in the supplier currency, so it may not match `price.totalPrice`.\n- `leg` (`outbound` / `return`) and `outboundId`: two-step round-trip view. `leg=outbound` lists each outbound departure once (its cheapest pair) with `returnOptions`; `leg=return&outboundId=<outbound id>` lists the pairs of that departure."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "cacheId": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "progress",
                        "success",
                        "success_partially",
                        "failed"
                      ],
                      "description": "Poll until it is not `pending`/`progress`."
                    },
                    "transportType": {
                      "type": "string",
                      "description": "Type the search was started for."
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true,
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Send as `itemId` to `POST /v1/cart/trains`. A round trip is cached as outbound x return pairs: `<outboundId>_RT_<inboundId>`."
                          },
                          "vehicleType": {
                            "type": "string",
                            "enum": [
                              "BUS",
                              "FERRY",
                              "TRAM",
                              "TRAIN"
                            ]
                          },
                          "origin": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "type": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "localLabel": {
                                "type": "string"
                              },
                              "timezone": {
                                "type": "string"
                              }
                            }
                          },
                          "destination": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "type": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "localLabel": {
                                "type": "string"
                              },
                              "timezone": {
                                "type": "string"
                              }
                            }
                          },
                          "departure": {
                            "type": "string",
                            "description": "Local time with offset, ISO-8601."
                          },
                          "arrival": {
                            "type": "string"
                          },
                          "duration": {
                            "type": "integer",
                            "description": "Minutes."
                          },
                          "connectionDuration": {
                            "type": "integer",
                            "description": "Minutes spent on changes."
                          },
                          "itineraries": {
                            "type": "array",
                            "description": "One per direction: `segments[]` (origin, destination, departure, arrival, duration, operationCarrier, marketingCarrier, vehicle), `segmentConnections[]`, `transfers`.",
                            "items": {
                              "type": "object"
                            }
                          },
                          "offers": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "description": "A fare of the result. Supplier and net price fields (`originalPrice`, `convertedPrice`, the price breakdown) are returned to Travel Code staff only.",
                              "additionalProperties": true,
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "description": "Send as `offers` to `POST /v1/cart/trains`."
                                },
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "outbound",
                                    "inbound"
                                  ]
                                },
                                "expiredAt": {
                                  "type": "integer",
                                  "description": "Unix time after which the fare cannot be added to the cart."
                                },
                                "price": {
                                  "type": [
                                    "object",
                                    "null"
                                  ],
                                  "description": "What the client pays.",
                                  "properties": {
                                    "totalPrice": {
                                      "type": "number"
                                    },
                                    "serviceFee": {
                                      "type": "number",
                                      "description": "Travel Code service fee included in `totalPrice`."
                                    },
                                    "currency": {
                                      "type": "string"
                                    }
                                  }
                                },
                                "comfortCategory": {
                                  "type": "object",
                                  "description": "Fare class label (e.g. standard / first)."
                                },
                                "flexibility": {
                                  "type": "object",
                                  "description": "Exchange/refund flexibility label."
                                },
                                "fare": {
                                  "type": "object",
                                  "description": "Fare conditions (`conditions` text, labels)."
                                },
                                "fares": {
                                  "type": "array",
                                  "items": {
                                    "type": "object"
                                  },
                                  "description": "Per-segment fares of a multi-fare offer."
                                },
                                "seatsLeft": {
                                  "type": [
                                    "integer",
                                    "null"
                                  ]
                                },
                                "outOfPolicy": {
                                  "type": "boolean",
                                  "description": "The fare breaks the caller's travel policy; it books only after approval."
                                },
                                "outOfPolicyReasons": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "hasSeatReservations": {
                                  "type": "boolean"
                                },
                                "availableServices": {
                                  "type": "array",
                                  "items": {}
                                }
                              }
                            }
                          },
                          "lowestPrice": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "description": "What the client pays.",
                            "properties": {
                              "totalPrice": {
                                "type": "number"
                              },
                              "serviceFee": {
                                "type": "number",
                                "description": "Travel Code service fee included in `totalPrice`."
                              },
                              "currency": {
                                "type": "string"
                              }
                            }
                          },
                          "nonRefundable": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "description": "Cheaper non-refundable fares of the same journey: `{offers[], lowestPrice}`. To book one, send its offer id and `nonRefundable: true` to the cart."
                          },
                          "operatingCarriers": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            },
                            "description": "Carrier codes; names and logos come with `embedded=carriers`."
                          },
                          "wifi": {
                            "type": "boolean"
                          },
                          "supportsSeats": {
                            "type": "boolean",
                            "description": "Seats can be chosen for this departure in the cart."
                          },
                          "fullRouteAvailable": {
                            "type": "boolean"
                          },
                          "co2": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "description": "`{kgPerPax, kgTotal, qualityTier}` estimate."
                          },
                          "returnOptions": {
                            "type": "integer",
                            "description": "Only with `filter[leg]=outbound`: how many return options the outbound departure has."
                          }
                        }
                      }
                    },
                    "total": {
                      "type": "integer",
                      "description": "Results after filters, before paging."
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "offset": {
                      "type": "integer"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "currencySign": {
                      "type": "string"
                    },
                    "warnings": {
                      "type": "array",
                      "description": "Supplier notices shown to the traveller (no answer from a supplier, date outside the sales window...).",
                      "items": {
                        "type": "object",
                        "properties": {
                          "code": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "policyHidesOffers": {
                      "type": "boolean",
                      "description": "Present when the travel policy hides out-of-policy results."
                    },
                    "policyTotalFound": {
                      "type": "integer",
                      "description": "Results found before the policy filter (with `policyHidesOffers`)."
                    },
                    "policyHiddenCount": {
                      "type": "integer"
                    },
                    "carriers": {
                      "type": "object",
                      "description": "With `embedded=carriers`: `{<carrierCode>: {name, logo}}`.",
                      "additionalProperties": {
                        "type": "object"
                      }
                    },
                    "filters": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "With `embedded=filters`: the accepted `filter[...]` keys."
                    }
                  }
                },
                "example": {
                  "cacheId": "Xk3vQ9...",
                  "status": "success",
                  "transportType": "BUS",
                  "items": [
                    {
                      "id": "2f9c1a...",
                      "vehicleType": "BUS",
                      "origin": {
                        "id": "8728",
                        "code": "DEBER",
                        "label": "Berlin Central Bus Station",
                        "timezone": "Europe/Berlin"
                      },
                      "destination": {
                        "id": "9113",
                        "code": "CZPRG",
                        "label": "Prague Florenc",
                        "timezone": "Europe/Prague"
                      },
                      "departure": "2026-12-18T08:15:00+01:00",
                      "arrival": "2026-12-18T12:40:00+01:00",
                      "duration": 265,
                      "offers": [
                        {
                          "id": "a1b2c3",
                          "type": "outbound",
                          "price": {
                            "totalPrice": 31.4,
                            "serviceFee": 2.0,
                            "currency": "EUR"
                          },
                          "outOfPolicy": false
                        }
                      ],
                      "lowestPrice": {
                        "totalPrice": 31.4,
                        "serviceFee": 2.0,
                        "currency": "EUR"
                      },
                      "operatingCarriers": [
                        "FLIX"
                      ],
                      "supportsSeats": false
                    }
                  ],
                  "total": 14,
                  "limit": 25,
                  "offset": 0,
                  "currency": "EUR",
                  "currencySign": "€",
                  "warnings": []
                }
              }
            }
          },
          "401": {
            "description": "Code `13` / `14`: no token, or token invalid."
          },
          "404": {
            "description": "Code `10`: unknown or expired `cacheId` - start a new search."
          }
        }
      }
    },
    "/v1/search/trams": {
      "post": {
        "tags": [
          "Bus, Ferry & Tram Search"
        ],
        "summary": "Kick off tram search",
        "description": "Starts an asynchronous tram search and returns a `cacheId` to poll. The request contract is shared by buses, ferries and trams (and `POST /v1/search/trains`).\n\nAccepts a JWT, an API token or an OAuth access token (`Authorization: Bearer`; no OAuth scope needed). Counts against the account's search allowance: over the per-minute limit `429` code `135`, over the daily limit `429` code `136` (with `Retry-After`).\n\nError bodies carry the numeric `code`; `message` starts with `[code]`.",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "Every key in `required` must be present in the body, even when it is empty (a missing key answers `400`, code `4`). For a one-way search send `dateTo` and `timeReturn` as `\"\"` and `service` as `[]`.",
                "required": [
                  "route",
                  "locationFrom",
                  "locationTo",
                  "date",
                  "timeTo",
                  "dateTo",
                  "timeReturn",
                  "adults",
                  "children",
                  "guests",
                  "service"
                ],
                "properties": {
                  "route": {
                    "type": "integer",
                    "enum": [
                      1,
                      2
                    ],
                    "default": 1,
                    "description": "1 one-way, 2 round trip."
                  },
                  "locationFrom": {
                    "type": "string",
                    "description": "Departure station **id** (numeric string) from `GET /v1/data/transport-stations?transportType=TRAM`. An unknown id answers `404`, code `12`."
                  },
                  "locationTo": {
                    "type": "string",
                    "description": "Arrival station id, same source."
                  },
                  "date": {
                    "type": "string",
                    "example": "18.12.2026",
                    "description": "Outbound date `DD.MM.YYYY`, today or later."
                  },
                  "timeTo": {
                    "type": "string",
                    "example": "08:00",
                    "description": "Earliest outbound departure `HH:MM`. Must not be empty."
                  },
                  "dateTo": {
                    "type": "string",
                    "description": "Return date `DD.MM.YYYY`, not before `date`. Required (non-empty) when `route` = 2, otherwise `\"\"`."
                  },
                  "timeReturn": {
                    "type": "string",
                    "description": "Earliest return departure `HH:MM`. Required (non-empty) when `route` = 2, otherwise `\"\"`."
                  },
                  "adults": {
                    "type": "integer",
                    "description": "Must be present; the count comes from `guests`."
                  },
                  "children": {
                    "type": "integer",
                    "description": "Must be present; the count comes from `guests`."
                  },
                  "guests": {
                    "type": "array",
                    "description": "Who travels. The passenger count is read from here only: the top-level `adults` / `children` fields are ignored. Send one entry. Total passengers (adults + seniors + children) must be 1-9.",
                    "items": {
                      "type": "object",
                      "required": [
                        "adults"
                      ],
                      "properties": {
                        "adults": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "seniors": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Passengers aged 60+."
                        },
                        "children": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "childrenAges": {
                          "type": "array",
                          "items": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 17
                          },
                          "description": "One age per child. The number of children is counted from this list."
                        }
                      }
                    },
                    "example": [
                      {
                        "adults": 2,
                        "seniors": 0,
                        "children": 1,
                        "childrenAges": [
                          7
                        ]
                      }
                    ]
                  },
                  "cabinClass": {
                    "type": "string",
                    "enum": [
                      "economy",
                      "business",
                      "first"
                    ],
                    "default": "economy"
                  },
                  "service": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Supplier filter. Honoured for Travel Code staff only and ignored for every other caller; send `[]`."
                  },
                  "currency": {
                    "type": "string",
                    "description": "Optional ISO-3 currency for the prices of this search (one of the supported currencies, otherwise `400`, code `22`). Defaults to the account currency."
                  }
                }
              },
              "example": {
                "route": 1,
                "locationFrom": "8728",
                "locationTo": "9113",
                "date": "18.12.2026",
                "timeTo": "06:00",
                "dateTo": "",
                "timeReturn": "",
                "adults": 1,
                "children": 0,
                "guests": [
                  {
                    "adults": 1,
                    "children": 0,
                    "childrenAges": []
                  }
                ],
                "service": []
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Search started.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "cacheId": {
                      "type": "string",
                      "description": "Search id. Poll `GET .../{cacheId}`; results are kept for 1 hour."
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "progress",
                        "success",
                        "success_partially",
                        "failed"
                      ]
                    },
                    "completed": {
                      "type": "boolean",
                      "description": "`true` once every supplier has answered (`success`, `success_partially` or `failed`)."
                    },
                    "transportType": {
                      "type": "string",
                      "enum": [
                        "BUS",
                        "FERRY",
                        "TRAM"
                      ]
                    },
                    "countServices": {
                      "type": "integer",
                      "description": "Suppliers queried."
                    },
                    "countFinishedServices": {
                      "type": "integer"
                    },
                    "countFailedServices": {
                      "type": "integer"
                    },
                    "count": {
                      "type": "integer",
                      "description": "Results already in (usually 0 right after the start)."
                    },
                    "errors": {
                      "type": "array",
                      "items": {}
                    },
                    "warnings": {
                      "type": "array",
                      "items": {}
                    }
                  }
                },
                "example": {
                  "status": "pending",
                  "errors": [],
                  "warnings": [],
                  "cacheId": "Xk3vQ9...",
                  "transportType": "TRAM",
                  "countServices": 1,
                  "countFinishedServices": 0,
                  "countFailedServices": 0,
                  "count": 0,
                  "completed": false
                }
              }
            }
          },
          "400": {
            "description": "Code `4`: a required key is missing. Code `11`: validation failed (empty time, past date, return before outbound, passengers not 1-9...). Code `18`: `date`/`dateTo` is not a real `DD.MM.YYYY` date. Code `19`: unknown `service` value. Code `22`: unsupported `currency`."
          },
          "401": {
            "description": "Code `13`: no token. Code `14`: token invalid or expired."
          },
          "403": {
            "description": "Code `141`: the company turned off booking by guest travellers."
          },
          "404": {
            "description": "Code `12`: station id not found."
          },
          "429": {
            "description": "Code `135` / `136`: search allowance spent (see `Retry-After`). Code `140`: daily limit of the free OAuth plan."
          }
        }
      }
    },
    "/v1/search/trams/{cacheId}": {
      "get": {
        "tags": [
          "Bus, Ferry & Tram Search"
        ],
        "summary": "Read tram search result",
        "description": "Results of a bus, ferry or tram search, filtered, sorted and paged. Poll until `status` is final; results stay readable for 1 hour after the start.\n\nThe bus, ferry, tram (and train) result endpoints are one shared reader keyed by `cacheId`, so any of them returns the search a `cacheId` belongs to; use the one that matches the search.\n\nPrices are the client's (`totalPrice` includes the Travel Code `serviceFee`). The supplier name (`serviceType`), net prices (`adminPrices`) and supplier fare fields are returned only to Travel Code staff signed in with a JWT or OAuth token, never to API-token callers.\n\nTo book: `POST /v1/cart/trains` with `sessionId` = `cacheId`, `itemId` = `items[].id`, `offers` = `items[].offers[].id`.\n\nError bodies carry the numeric `code`; `message` starts with `[code]`.",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": []
          }
        ],
        "parameters": [
          {
            "name": "cacheId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "`cacheId` from the POST."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 25
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 0
            }
          },
          {
            "name": "sort",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "price",
                "fast",
                "departure"
              ]
            },
            "description": "Ascending. Without it results keep the supplier order."
          },
          {
            "name": "embedded",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Comma-separated: `carriers`, `filters`."
          },
          {
            "name": "filter",
            "in": "query",
            "style": "deepObject",
            "explode": true,
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            },
            "description": "Optional filters as `filter[<key>]=<value>`:\n- `departureMin` / `departureMax`, `departureReturnMin` / `departureReturnMax`: minutes after midnight, station local time (`480` = 08:00).\n- `durationMin` / `durationMax`: minutes.\n- `transfer` / `transferReturn`: number of changes `0`, `1`, `2`, or `3` (= 3 or more); `all` = no filter.\n- `carrier`: carrier codes, comma-separated.\n- `trainNumber`: service number (spaces and case ignored).\n- `wifi`: `true` for Wi-Fi only.\n- `minprice` / `maxprice`: compared with the supplier's own fare before Travel Code fees, in the supplier currency, so it may not match `price.totalPrice`.\n- `leg` (`outbound` / `return`) and `outboundId`: two-step round-trip view. `leg=outbound` lists each outbound departure once (its cheapest pair) with `returnOptions`; `leg=return&outboundId=<outbound id>` lists the pairs of that departure."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "cacheId": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "progress",
                        "success",
                        "success_partially",
                        "failed"
                      ],
                      "description": "Poll until it is not `pending`/`progress`."
                    },
                    "transportType": {
                      "type": "string",
                      "description": "Type the search was started for."
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true,
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Send as `itemId` to `POST /v1/cart/trains`. A round trip is cached as outbound x return pairs: `<outboundId>_RT_<inboundId>`."
                          },
                          "vehicleType": {
                            "type": "string",
                            "enum": [
                              "BUS",
                              "FERRY",
                              "TRAM",
                              "TRAIN"
                            ]
                          },
                          "origin": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "type": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "localLabel": {
                                "type": "string"
                              },
                              "timezone": {
                                "type": "string"
                              }
                            }
                          },
                          "destination": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "type": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "localLabel": {
                                "type": "string"
                              },
                              "timezone": {
                                "type": "string"
                              }
                            }
                          },
                          "departure": {
                            "type": "string",
                            "description": "Local time with offset, ISO-8601."
                          },
                          "arrival": {
                            "type": "string"
                          },
                          "duration": {
                            "type": "integer",
                            "description": "Minutes."
                          },
                          "connectionDuration": {
                            "type": "integer",
                            "description": "Minutes spent on changes."
                          },
                          "itineraries": {
                            "type": "array",
                            "description": "One per direction: `segments[]` (origin, destination, departure, arrival, duration, operationCarrier, marketingCarrier, vehicle), `segmentConnections[]`, `transfers`.",
                            "items": {
                              "type": "object"
                            }
                          },
                          "offers": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "description": "A fare of the result. Supplier and net price fields (`originalPrice`, `convertedPrice`, the price breakdown) are returned to Travel Code staff only.",
                              "additionalProperties": true,
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "description": "Send as `offers` to `POST /v1/cart/trains`."
                                },
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "outbound",
                                    "inbound"
                                  ]
                                },
                                "expiredAt": {
                                  "type": "integer",
                                  "description": "Unix time after which the fare cannot be added to the cart."
                                },
                                "price": {
                                  "type": [
                                    "object",
                                    "null"
                                  ],
                                  "description": "What the client pays.",
                                  "properties": {
                                    "totalPrice": {
                                      "type": "number"
                                    },
                                    "serviceFee": {
                                      "type": "number",
                                      "description": "Travel Code service fee included in `totalPrice`."
                                    },
                                    "currency": {
                                      "type": "string"
                                    }
                                  }
                                },
                                "comfortCategory": {
                                  "type": "object",
                                  "description": "Fare class label (e.g. standard / first)."
                                },
                                "flexibility": {
                                  "type": "object",
                                  "description": "Exchange/refund flexibility label."
                                },
                                "fare": {
                                  "type": "object",
                                  "description": "Fare conditions (`conditions` text, labels)."
                                },
                                "fares": {
                                  "type": "array",
                                  "items": {
                                    "type": "object"
                                  },
                                  "description": "Per-segment fares of a multi-fare offer."
                                },
                                "seatsLeft": {
                                  "type": [
                                    "integer",
                                    "null"
                                  ]
                                },
                                "outOfPolicy": {
                                  "type": "boolean",
                                  "description": "The fare breaks the caller's travel policy; it books only after approval."
                                },
                                "outOfPolicyReasons": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "hasSeatReservations": {
                                  "type": "boolean"
                                },
                                "availableServices": {
                                  "type": "array",
                                  "items": {}
                                }
                              }
                            }
                          },
                          "lowestPrice": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "description": "What the client pays.",
                            "properties": {
                              "totalPrice": {
                                "type": "number"
                              },
                              "serviceFee": {
                                "type": "number",
                                "description": "Travel Code service fee included in `totalPrice`."
                              },
                              "currency": {
                                "type": "string"
                              }
                            }
                          },
                          "nonRefundable": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "description": "Cheaper non-refundable fares of the same journey: `{offers[], lowestPrice}`. To book one, send its offer id and `nonRefundable: true` to the cart."
                          },
                          "operatingCarriers": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            },
                            "description": "Carrier codes; names and logos come with `embedded=carriers`."
                          },
                          "wifi": {
                            "type": "boolean"
                          },
                          "supportsSeats": {
                            "type": "boolean",
                            "description": "Seats can be chosen for this departure in the cart."
                          },
                          "fullRouteAvailable": {
                            "type": "boolean"
                          },
                          "co2": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "description": "`{kgPerPax, kgTotal, qualityTier}` estimate."
                          },
                          "returnOptions": {
                            "type": "integer",
                            "description": "Only with `filter[leg]=outbound`: how many return options the outbound departure has."
                          }
                        }
                      }
                    },
                    "total": {
                      "type": "integer",
                      "description": "Results after filters, before paging."
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "offset": {
                      "type": "integer"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "currencySign": {
                      "type": "string"
                    },
                    "warnings": {
                      "type": "array",
                      "description": "Supplier notices shown to the traveller (no answer from a supplier, date outside the sales window...).",
                      "items": {
                        "type": "object",
                        "properties": {
                          "code": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "policyHidesOffers": {
                      "type": "boolean",
                      "description": "Present when the travel policy hides out-of-policy results."
                    },
                    "policyTotalFound": {
                      "type": "integer",
                      "description": "Results found before the policy filter (with `policyHidesOffers`)."
                    },
                    "policyHiddenCount": {
                      "type": "integer"
                    },
                    "carriers": {
                      "type": "object",
                      "description": "With `embedded=carriers`: `{<carrierCode>: {name, logo}}`.",
                      "additionalProperties": {
                        "type": "object"
                      }
                    },
                    "filters": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "With `embedded=filters`: the accepted `filter[...]` keys."
                    }
                  }
                },
                "example": {
                  "cacheId": "Xk3vQ9...",
                  "status": "success",
                  "transportType": "BUS",
                  "items": [
                    {
                      "id": "2f9c1a...",
                      "vehicleType": "BUS",
                      "origin": {
                        "id": "8728",
                        "code": "DEBER",
                        "label": "Berlin Central Bus Station",
                        "timezone": "Europe/Berlin"
                      },
                      "destination": {
                        "id": "9113",
                        "code": "CZPRG",
                        "label": "Prague Florenc",
                        "timezone": "Europe/Prague"
                      },
                      "departure": "2026-12-18T08:15:00+01:00",
                      "arrival": "2026-12-18T12:40:00+01:00",
                      "duration": 265,
                      "offers": [
                        {
                          "id": "a1b2c3",
                          "type": "outbound",
                          "price": {
                            "totalPrice": 31.4,
                            "serviceFee": 2.0,
                            "currency": "EUR"
                          },
                          "outOfPolicy": false
                        }
                      ],
                      "lowestPrice": {
                        "totalPrice": 31.4,
                        "serviceFee": 2.0,
                        "currency": "EUR"
                      },
                      "operatingCarriers": [
                        "FLIX"
                      ],
                      "supportsSeats": false
                    }
                  ],
                  "total": 14,
                  "limit": 25,
                  "offset": 0,
                  "currency": "EUR",
                  "currencySign": "€",
                  "warnings": []
                }
              }
            }
          },
          "401": {
            "description": "Code `13` / `14`: no token, or token invalid."
          },
          "404": {
            "description": "Code `10`: unknown or expired `cacheId` - start a new search."
          }
        }
      }
    },
    "/v1/search/cars": {
      "post": {
        "tags": [
          "Car Rental Search"
        ],
        "summary": "Kick off car rental search",
        "description": "Starts an asynchronous car rental search and returns a `cacheId` to poll. Requires a signed-in caller (corporate rates and suppliers depend on the account).\n\nAccepts a JWT, an API token or an OAuth access token (`Authorization: Bearer`; no OAuth scope needed). The company's car module must be on. Counts against the account's search allowance (`429`, code `135` per minute / `136` per day, with `Retry-After`).\n\nError bodies carry the numeric `code`; `message` starts with `[code]`.",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "pickupLocation",
                  "dropoffLocation",
                  "pickupAt",
                  "dropoffAt",
                  "driverAge",
                  "driverResidence"
                ],
                "properties": {
                  "pickupLocation": {
                    "type": "string",
                    "maxLength": 255,
                    "description": "One of: an airport IATA code (`WAW`); `p:<Google place id>` (from `GET /v1/data/locations-autocomplete`); `g:<lat>,<lng>[,<radiusKm>]` for a point (radius 1-50 km, default 10; out-of-range values are clamped). A city/station point finds far more rental desks than an airport code.",
                    "example": "g:45.4642,9.19,10"
                  },
                  "dropoffLocation": {
                    "type": "string",
                    "maxLength": 255,
                    "description": "Same formats. Send the pickup value again for a return to the same place."
                  },
                  "pickupAt": {
                    "type": "string",
                    "example": "2026-12-20T10:00:00",
                    "description": "Local date-time `YYYY-MM-DDTHH:MM:SS` (no offset)."
                  },
                  "dropoffAt": {
                    "type": "string",
                    "example": "2026-12-23T10:00:00"
                  },
                  "driverAge": {
                    "type": "integer",
                    "minimum": 18,
                    "maximum": 99
                  },
                  "driverResidence": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 2,
                    "description": "Driver's country of residence, ISO 3166-1 alpha-2."
                  },
                  "currency": {
                    "type": "string",
                    "description": "ISO-3 currency for the prices; defaults to the account currency. Unsupported values answer `400`, code `22`."
                  },
                  "service": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Optional supplier filter; leave out."
                  }
                }
              },
              "example": {
                "pickupLocation": "MXP",
                "dropoffLocation": "MXP",
                "pickupAt": "2026-12-20T10:00:00",
                "dropoffAt": "2026-12-23T10:00:00",
                "driverAge": 35,
                "driverResidence": "DE",
                "currency": "EUR"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Search started.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "cacheId": {
                      "type": "string",
                      "description": "Poll `GET /v1/search/cars/{cacheId}`; kept for 1 hour."
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "progress",
                        "success",
                        "success_partially",
                        "failed"
                      ]
                    },
                    "completed": {
                      "type": "boolean"
                    },
                    "countServices": {
                      "type": "integer"
                    },
                    "countFinishedServices": {
                      "type": "integer"
                    },
                    "countFailedServices": {
                      "type": "integer"
                    },
                    "count": {
                      "type": "integer"
                    },
                    "services": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Internal identifiers of the suppliers queried. Informational; do not rely on the values."
                    },
                    "errors": {
                      "type": "array",
                      "items": {}
                    },
                    "warnings": {
                      "type": "array",
                      "items": {}
                    }
                  }
                },
                "example": {
                  "status": "pending",
                  "errors": [],
                  "warnings": [],
                  "cacheId": "Rk82sd...",
                  "countServices": 1,
                  "countFinishedServices": 0,
                  "countFailedServices": 0,
                  "count": 0,
                  "completed": false,
                  "services": [
                    "..."
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Code `4`: a required field is missing. Code `11`: validation failed (date-time format, driver age 18-99, residence not 2 letters, malformed `g:` coordinates...). Code `22`: unsupported `currency`."
          },
          "401": {
            "description": "Code `13`: no token. Code `14`: token invalid or expired."
          },
          "403": {
            "description": "Code `130`: the car module is turned off for the company. Code `141`: the company turned off booking by guest travellers. Code `6`: the traveller's company event does not include cars."
          },
          "429": {
            "description": "Code `135` / `136`: search allowance spent. Code `140`: daily limit of the free OAuth plan."
          }
        }
      }
    },
    "/v1/search/cars/{cacheId}": {
      "get": {
        "tags": [
          "Car Rental Search"
        ],
        "summary": "Read car rental search result",
        "description": "Offers found so far. Poll until `completed` is `true`; results stay readable for 1 hour after the start. Prices are the client's, Travel Code fee included.\n\nTo book: `POST /v1/cart/cars` with `sessionId` = `cacheId` and `offerId` = `items[].offer_id`.\n\nError bodies carry the numeric `code`; `message` starts with `[code]`.",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": []
          }
        ],
        "parameters": [
          {
            "name": "cacheId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "`cacheId` from the POST."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "cacheId": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "progress",
                        "success",
                        "success_partially",
                        "failed"
                      ]
                    },
                    "completed": {
                      "type": "boolean",
                      "description": "Stop polling when `true`. A search that has not finished by its deadline is closed as `success_partially` or `failed`."
                    },
                    "count": {
                      "type": "integer"
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "description": "One rental offer. Fields are snake_case (except `negotiatedRate`, `contractSavings`). The supplier identifier (`service`) and the supplier's own booking link (`url`) are returned to Travel Code staff only.",
                        "properties": {
                          "offer_id": {
                            "type": "string",
                            "description": "Send as `offerId` to `POST /v1/cart/cars`."
                          },
                          "booked_by_us": {
                            "type": "boolean",
                            "description": "`true`: bookable through the cart. `false`: the offer can only be requested on the site; `POST /v1/cart/cars` refuses it."
                          },
                          "search_hash": {
                            "type": "string",
                            "description": "Opaque; not needed by the cart endpoint."
                          },
                          "pickup": {
                            "allOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "location": {
                                    "type": "string"
                                  },
                                  "address": {
                                    "type": "string"
                                  },
                                  "lat": {
                                    "type": "number"
                                  },
                                  "lng": {
                                    "type": "number"
                                  },
                                  "location_type": {
                                    "type": "string",
                                    "description": "Airport, city, railway station..."
                                  },
                                  "phone": {
                                    "type": "string"
                                  },
                                  "email": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "opening_hours": {
                                    "description": "Desk opening hours as the supplier gives them, or null."
                                  },
                                  "instructions": {
                                    "type": "string"
                                  }
                                }
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "pickup_at": {
                                    "type": "string"
                                  }
                                }
                              }
                            ]
                          },
                          "dropoff": {
                            "allOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "location": {
                                    "type": "string"
                                  },
                                  "address": {
                                    "type": "string"
                                  },
                                  "lat": {
                                    "type": "number"
                                  },
                                  "lng": {
                                    "type": "number"
                                  },
                                  "location_type": {
                                    "type": "string",
                                    "description": "Airport, city, railway station..."
                                  },
                                  "phone": {
                                    "type": "string"
                                  },
                                  "email": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "opening_hours": {
                                    "description": "Desk opening hours as the supplier gives them, or null."
                                  },
                                  "instructions": {
                                    "type": "string"
                                  }
                                }
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "dropoff_at": {
                                    "type": "string"
                                  }
                                }
                              }
                            ]
                          },
                          "car": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string",
                                "description": "Model, usually \"or similar\"."
                              },
                              "sipp": {
                                "type": "string",
                                "description": "ACRISS/SIPP code."
                              },
                              "category": {
                                "type": "string"
                              },
                              "image": {
                                "type": "string"
                              },
                              "seats": {
                                "type": "integer"
                              },
                              "doors": {
                                "type": "integer"
                              },
                              "bags": {
                                "type": "integer"
                              },
                              "transmission": {
                                "type": "string"
                              },
                              "fuel": {
                                "type": "string",
                                "description": "Fuel policy, e.g. `full_to_full`."
                              },
                              "fuel_type": {
                                "type": "string"
                              },
                              "air_conditioning": {
                                "type": "boolean"
                              }
                            }
                          },
                          "price": {
                            "type": "object",
                            "properties": {
                              "total": {
                                "type": "number",
                                "description": "Full price for the client, Travel Code fee included."
                              },
                              "currency": {
                                "type": "string"
                              },
                              "type": {
                                "type": "string",
                                "description": "Supplier rate type (prepaid / pay on arrival)."
                              },
                              "pay_now": {
                                "type": "number",
                                "description": "Charged at booking (includes `service_fee`)."
                              },
                              "pay_later": {
                                "type": "number",
                                "description": "Paid at the rental desk."
                              },
                              "service_fee": {
                                "type": "number"
                              }
                            }
                          },
                          "supplier": {
                            "type": "object",
                            "description": "The rental company.",
                            "properties": {
                              "id": {},
                              "name": {
                                "type": "string"
                              },
                              "address": {
                                "type": "string"
                              },
                              "location_type": {
                                "type": "string"
                              },
                              "rating": {},
                              "logo": {
                                "type": "string"
                              },
                              "lat": {},
                              "lng": {}
                            }
                          },
                          "included_options": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {},
                                "name": {
                                  "type": "string"
                                }
                              }
                            }
                          },
                          "deposit": {
                            "type": "object",
                            "properties": {
                              "min": {
                                "type": "number"
                              },
                              "max": {
                                "type": "number"
                              },
                              "currency": {
                                "type": "string"
                              }
                            }
                          },
                          "excess": {
                            "type": "object",
                            "properties": {
                              "min": {
                                "type": "number"
                              },
                              "max": {
                                "type": "number"
                              },
                              "currency": {
                                "type": "string"
                              }
                            }
                          },
                          "mileage": {
                            "type": "object",
                            "properties": {
                              "unlimited": {
                                "type": "boolean"
                              },
                              "included_limit": {
                                "type": "integer"
                              },
                              "unit": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            }
                          },
                          "cancellation": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "description": "e.g. `free`."
                              },
                              "details": {
                                "type": "object",
                                "properties": {
                                  "hours_before_pickup": {
                                    "type": "integer"
                                  }
                                }
                              }
                            }
                          },
                          "ldw_status": {
                            "type": "string",
                            "description": "Set only when the travel policy requires collision damage waiver: `included` or `addon` (buy at the desk). Empty otherwise."
                          },
                          "negotiatedRate": {
                            "type": "boolean",
                            "description": "Priced with the company's own negotiated rate."
                          },
                          "contractSavings": {
                            "type": [
                              "number",
                              "null"
                            ],
                            "description": "Saving against the public offer, when a negotiated rate is cheaper."
                          },
                          "co2": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "description": "`{kgPerPax, kgTotal, qualityTier}` estimate."
                          }
                        }
                      },
                      "description": "All offers found so far; no paging, sorting or filters."
                    },
                    "servicesLeft": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Suppliers still searching (internal identifiers)."
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Diagnostic messages of suppliers that failed. Do not parse."
                    },
                    "currency": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Code `13` / `14`: no token, or token invalid."
          },
          "404": {
            "description": "Code `10`: unknown or expired `cacheId` - start a new search."
          }
        }
      }
    },
    "/v1/cart": {
      "get": {
        "tags": [
          "Cart"
        ],
        "summary": "Read the cart",
        "description": "The caller's active cart as the cart page sees it (expired services dropped): services, the traveller places to fill, who it is booked for, totals, policy status and payment options. Read it before `POST /v1/cart/checkout` to get the place numbers and payment methods.\n\nAccepts a JWT, an API token or an OAuth access token with scope `orders:read` (`Authorization: Bearer`); widget tokens are refused (`401`, code `14`). The cart is the caller's own cart, the same one they see on the site: services go into the newest draft (or approved) trip, or the trip named by the optional `?tripId=` query parameter.",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": [
              "orders:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "tripId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Read this cart trip instead of the newest editable one."
          }
        ],
        "responses": {
          "200": {
            "description": "OK. When the cart cannot be used only `state` comes back.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "state": {
                      "type": "string",
                      "enum": [
                        "ready",
                        "empty",
                        "rejected",
                        "redirect",
                        "login"
                      ],
                      "description": "Everything below is present only for `ready`."
                    },
                    "trip": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "title": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        }
                      }
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      },
                      "description": "The services, as the cart page lists them."
                    },
                    "travellers": {
                      "type": "object",
                      "description": "`slots[]`: one place per traveller - `index` (send as `slot`), `type` (adult / child / infant), `childAge`, `services`, `prefill` (`{clientId, docId}` already chosen, or null); plus `docsRequired`, `requiredNationality`, `customFields`."
                    },
                    "bookingFor": {
                      "type": "object",
                      "description": "Buyer and paying companies the cart resolved (`buyer`, `companies[]`, `companyId`, `ownerId`)."
                    },
                    "currency": {
                      "type": "string"
                    },
                    "totals": {
                      "type": "object",
                      "properties": {
                        "grandTotal": {
                          "type": "number"
                        },
                        "toPay": {
                          "type": [
                            "number",
                            "null"
                          ]
                        }
                      }
                    },
                    "expiresAt": {
                      "type": "integer",
                      "description": "Unix time the prices hold until."
                    },
                    "policy": {
                      "type": "object",
                      "properties": {
                        "outOfPolicy": {
                          "type": "boolean"
                        },
                        "blocked": {
                          "type": "boolean",
                          "description": "The policy forbids booking this cart."
                        },
                        "sendPoliciesForApproved": {
                          "type": "boolean"
                        },
                        "approvers": {
                          "type": "array",
                          "items": {}
                        }
                      }
                    },
                    "payment": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "description": "Payment options: a fixed company `profile` method, or tabs such as `deposit` (`balance`, `enough`), `transfer`, `card` (saved cards), `crypto`."
                    }
                  }
                },
                "example": {
                  "state": "empty"
                }
              }
            }
          },
          "401": {
            "description": "Code `13` / `14`: no token, token invalid, or a widget token."
          },
          "403": {
            "description": "Code `139`: the OAuth token lacks scope `orders:read`."
          }
        }
      }
    },
    "/v1/cart/trains": {
      "post": {
        "tags": [
          "Cart"
        ],
        "summary": "Add a train, bus, ferry or tram fare to the cart",
        "description": "Puts a fare of a transport search into the caller's cart. Works for train searches and, with the same body, for bus, ferry and tram searches (all of them share one search cache and one cart service type, as on the site).\n\nThe supplier prices the fare again at this moment; the travel-policy verdict is the one the search computed for the chosen offer. Travellers, seats, approval and payment are then handled by `GET /v1/cart` and `POST /v1/cart/checkout`.\n\nAccepts a JWT, an API token or an OAuth access token with scope `orders:write` (`Authorization: Bearer`); widget tokens are refused (`401`, code `14`). The cart is the caller's own cart, the same one they see on the site: services go into the newest draft (or approved) trip, or the trip named by the optional `?tripId=` query parameter.",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": [
              "orders:write"
            ]
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "sessionId",
                  "itemId",
                  "offers"
                ],
                "properties": {
                  "sessionId": {
                    "type": "string",
                    "description": "`cacheId` of the search."
                  },
                  "itemId": {
                    "type": "string",
                    "description": "`items[].id` of the chosen result (a round-trip pair id for a round trip)."
                  },
                  "offers": {
                    "type": "string",
                    "description": "`items[].offers[].id` of the chosen fare. For a round trip: the outbound and the return offer ids joined with `_RT_`."
                  },
                  "nonRefundable": {
                    "type": "boolean",
                    "default": false,
                    "description": "`true` to book the item's `nonRefundable` variant; `offers` then names offers of `items[].nonRefundable.offers`."
                  }
                }
              },
              "example": {
                "sessionId": "Xk3vQ9...",
                "itemId": "2f9c1a...",
                "offers": "a1b2c3",
                "nonRefundable": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Added.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "added": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "title": {
                      "type": "string",
                      "description": "Title of the cart service."
                    },
                    "cartUrl": {
                      "type": "string",
                      "example": "/basket",
                      "description": "Site path of the cart."
                    },
                    "trip": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "description": "The cart trip the service went into.",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "title": {
                          "type": "string"
                        }
                      }
                    },
                    "outOfPolicy": {
                      "type": "boolean",
                      "description": "The fare breaks the travel policy: the trip needs approval (`POST /v1/cart/approval`) before it can be booked."
                    }
                  }
                },
                "example": {
                  "added": true,
                  "title": "Berlin - Prague",
                  "outOfPolicy": false,
                  "cartUrl": "/basket",
                  "trip": {
                    "id": 5521,
                    "title": "Prague, 18 Dec"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Code `13` / `14`: no token, token invalid, or a widget token."
          },
          "403": {
            "description": "Code `139`: the OAuth token lacks scope `orders:write`."
          },
          "409": {
            "description": "Code `10`: the search expired, the fare is gone or the supplier refused to price it - search again."
          },
          "422": {
            "description": "Refused: `{\"errors\": {\"<field>\": [\"<message>\"]}}` (no numeric code). The messages are for display."
          }
        }
      }
    },
    "/v1/cart/cars": {
      "post": {
        "tags": [
          "Cart"
        ],
        "summary": "Add a rental car to the cart",
        "description": "Puts a car offer of `POST /v1/search/cars` into the caller's cart. The supplier confirms the offer details and price at this moment; the price is restated in the account currency (the desk part, `pay_later`, stays in the supplier's currency). Only offers with `booked_by_us: true` are accepted. The driver, approval and payment are handled in the cart.\n\nAccepts a JWT, an API token or an OAuth access token with scope `orders:write` (`Authorization: Bearer`); widget tokens are refused (`401`, code `14`). The cart is the caller's own cart, the same one they see on the site: services go into the newest draft (or approved) trip, or the trip named by the optional `?tripId=` query parameter.",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": [
              "orders:write"
            ]
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "sessionId",
                  "offerId"
                ],
                "properties": {
                  "sessionId": {
                    "type": "string",
                    "description": "`cacheId` of the car search."
                  },
                  "offerId": {
                    "type": "string",
                    "description": "`items[].offer_id` of the chosen car."
                  },
                  "nationality": {
                    "type": "string",
                    "description": "Driver's residence, ISO-2, as sent to the search (`driverResidence`)."
                  },
                  "age": {
                    "type": "integer",
                    "description": "Driver's age, as sent to the search (`driverAge`)."
                  },
                  "country": {
                    "type": "string",
                    "description": "English country name of the pickup. Needed only when the supplier does not give the country on the offer."
                  }
                }
              },
              "example": {
                "sessionId": "Rk82sd...",
                "offerId": "AMC-1-4471",
                "nationality": "DE",
                "age": 35
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Added.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "added": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "title": {
                      "type": "string",
                      "description": "Title of the cart service."
                    },
                    "cartUrl": {
                      "type": "string",
                      "example": "/basket",
                      "description": "Site path of the cart."
                    },
                    "trip": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "description": "The cart trip the service went into.",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "title": {
                          "type": "string"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "added": true,
                  "title": "Fiat 500 or similar",
                  "cartUrl": "/basket",
                  "trip": {
                    "id": 5521,
                    "title": "Milan, 20 Dec"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Code `13` / `14`: no token, token invalid, or a widget token."
          },
          "403": {
            "description": "Code `139`: the OAuth token lacks scope `orders:write`."
          },
          "422": {
            "description": "Refused: `{\"errors\": {\"<field>\": [\"<message>\"]}}`. `sessionId` / `offerId` missing; `offer`: the search expired, the offer is not in it, the offer is request-only (`booked_by_us: false`), the supplier refused, or the pickup country is unknown. An expired search is also answered here (not with `409`): search again."
          }
        }
      }
    },
    "/v1/cart/checkout": {
      "post": {
        "tags": [
          "Cart"
        ],
        "summary": "Book the cart",
        "description": "Books the caller's active cart with the same checks as the site's Book button and creates one order for it. Send `travellers` (or the full `ServiceBasketForm[clients]`) and the payment method. One of `travellers` / `ServiceBasketForm` must be present.\n\nA refused booking still answers `200` with `success: false`: read `errors`, `messages`, `riskWarnings` and `duplicateOrderId`. If `riskWarnings` is not empty (document problems), repeat with `doc_risk_acknowledged: 1`; if `duplicateOrderId` is set (a similar order exists), repeat with `basket_dup_acknowledged: 1` to book anyway.\n\nA cart that breaks the travel policy goes to approval first (`POST /v1/cart/approval`). Carts with a Trenitalia ticket must be finished on the site.\n\nAccepts a JWT, an API token or an OAuth access token with scope `orders:write` (`Authorization: Bearer`); widget tokens are refused (`401`, code `14`). The cart is the caller's own cart, the same one they see on the site: services go into the newest draft (or approved) trip, or the trip named by the optional `?tripId=` query parameter.",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": [
              "orders:write"
            ]
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "travellers": {
                    "type": "array",
                    "description": "Who takes each traveller place: `slot` = `travellers.slots[].index` from `GET /v1/cart`, `clientId` = a traveller card (see Travelers / Clients), `docId` = one of the card's documents (default: the card's current document). Places not listed keep their `prefill`.",
                    "items": {
                      "type": "object",
                      "required": [
                        "slot",
                        "clientId"
                      ],
                      "properties": {
                        "slot": {
                          "type": "integer",
                          "minimum": 1
                        },
                        "clientId": {
                          "type": "integer"
                        },
                        "docId": {
                          "type": "integer"
                        }
                      }
                    }
                  },
                  "ServiceBasketForm": {
                    "type": "object",
                    "description": "The site's cart form. Usually only `paymentMethod` is needed; the buyer (`userId`) and the paying company (`agencyId`) default to the ones the cart resolves and may only repeat them.",
                    "additionalProperties": true,
                    "properties": {
                      "paymentMethod": {
                        "type": "string",
                        "description": "How to pay, from `payment` in `GET /v1/cart`: `deposit` (company balance), `transfer` (invoice), `exist-<savedCardId>`, `new-<storeId>` (new card: `nextUrl` is then the payment page). When the company's payment profile fixes the method, that method is used."
                      },
                      "bookType": {
                        "type": "string",
                        "enum": [
                          "booking",
                          "preBook"
                        ],
                        "default": "booking"
                      },
                      "costCenterId": {
                        "type": "integer",
                        "description": "When the company uses cost centers."
                      },
                      "comment": {
                        "type": "string"
                      },
                      "promoCode": {
                        "type": "string"
                      },
                      "userId": {
                        "type": "integer",
                        "description": "Buyer; must be the caller or the cart's buyer."
                      },
                      "agencyId": {
                        "type": "integer",
                        "description": "Paying company; must be one of `bookingFor.companies`."
                      }
                    }
                  },
                  "doc_risk_acknowledged": {
                    "type": "integer",
                    "enum": [
                      0,
                      1
                    ]
                  },
                  "basket_dup_acknowledged": {
                    "type": "integer",
                    "enum": [
                      0,
                      1
                    ]
                  }
                }
              },
              "example": {
                "travellers": [
                  {
                    "slot": 1,
                    "clientId": 81234
                  }
                ],
                "ServiceBasketForm": {
                  "paymentMethod": "transfer"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Booked (`success: true`) or refused (`success: false`).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "orderId": {
                      "type": "integer",
                      "description": "Travel Code order id; continue with `GET /v1/orders/{id}`."
                    },
                    "orderCode": {
                      "type": "string"
                    },
                    "payOrderId": {
                      "description": "Payment id when a card payment was started."
                    },
                    "nextUrl": {
                      "type": "string",
                      "description": "Site page to open next: the card payment page, or the order confirmation page."
                    },
                    "errors": {
                      "type": "object",
                      "description": "Refusal: field errors keyed by form field id.",
                      "additionalProperties": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    },
                    "messages": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "enum": [
                              "error",
                              "warning"
                            ]
                          },
                          "text": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "riskWarnings": {
                      "type": "array",
                      "items": {}
                    },
                    "duplicateOrderId": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "duplicateOrderCode": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "incidentId": {
                      "description": "Reference for support when the supplier booking failed."
                    },
                    "splitFailed": {
                      "type": "boolean",
                      "description": "A split payment between company and traveller failed; see `splitFailReason` / `splitFailMessage`."
                    },
                    "splitFailReason": {
                      "type": "string"
                    },
                    "splitFailMessage": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "success": true,
                  "orderId": 66012,
                  "orderCode": "TC-66012",
                  "payOrderId": null,
                  "nextUrl": "/orders/confirm-page?id=66012"
                }
              }
            }
          },
          "401": {
            "description": "Code `13` / `14`: no token, token invalid, or a widget token."
          },
          "403": {
            "description": "Code `139`: the OAuth token lacks scope `orders:write`."
          },
          "409": {
            "description": "Code `5`: there is no cart to book (empty, rejected or otherwise not ready). Read `GET /v1/cart` for its `state`."
          },
          "422": {
            "description": "Refused before booking: `{\"errors\": {...}}` - neither `travellers` nor `ServiceBasketForm` sent, a document that is not the traveller's (`travellers.<slot>.docId`), a buyer or company the cart is not booked for (`userId`, `agencyId`), or a Trenitalia ticket in the cart (`cart`)."
          }
        }
      }
    },
    "/v1/cart/approval": {
      "post": {
        "tags": [
          "Cart"
        ],
        "summary": "Send the cart for approval",
        "description": "Sends the caller's active cart to its approvers, like the cart's Send for approval button. Available only when someone has to approve: an out-of-policy service, or a company approval rule over the cart price. The body is the same as for checkout, plus an optional `approvalComment`. After approval the cart is booked with `POST /v1/cart/checkout`.\n\nAccepts a JWT, an API token or an OAuth access token with scope `orders:write` (`Authorization: Bearer`); widget tokens are refused (`401`, code `14`). The cart is the caller's own cart, the same one they see on the site: services go into the newest draft (or approved) trip, or the trip named by the optional `?tripId=` query parameter.",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": [
              "orders:write"
            ]
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "travellers": {
                    "type": "array",
                    "description": "Who takes each traveller place: `slot` = `travellers.slots[].index` from `GET /v1/cart`, `clientId` = a traveller card (see Travelers / Clients), `docId` = one of the card's documents (default: the card's current document). Places not listed keep their `prefill`.",
                    "items": {
                      "type": "object",
                      "required": [
                        "slot",
                        "clientId"
                      ],
                      "properties": {
                        "slot": {
                          "type": "integer",
                          "minimum": 1
                        },
                        "clientId": {
                          "type": "integer"
                        },
                        "docId": {
                          "type": "integer"
                        }
                      }
                    }
                  },
                  "ServiceBasketForm": {
                    "type": "object",
                    "description": "The site's cart form. Usually only `paymentMethod` is needed; the buyer (`userId`) and the paying company (`agencyId`) default to the ones the cart resolves and may only repeat them.",
                    "additionalProperties": true,
                    "properties": {
                      "paymentMethod": {
                        "type": "string",
                        "description": "How to pay, from `payment` in `GET /v1/cart`: `deposit` (company balance), `transfer` (invoice), `exist-<savedCardId>`, `new-<storeId>` (new card: `nextUrl` is then the payment page). When the company's payment profile fixes the method, that method is used."
                      },
                      "bookType": {
                        "type": "string",
                        "enum": [
                          "booking",
                          "preBook"
                        ],
                        "default": "booking"
                      },
                      "costCenterId": {
                        "type": "integer",
                        "description": "When the company uses cost centers."
                      },
                      "comment": {
                        "type": "string"
                      },
                      "promoCode": {
                        "type": "string"
                      },
                      "userId": {
                        "type": "integer",
                        "description": "Buyer; must be the caller or the cart's buyer."
                      },
                      "agencyId": {
                        "type": "integer",
                        "description": "Paying company; must be one of `bookingFor.companies`."
                      }
                    }
                  },
                  "approvalComment": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "travellers": [
                  {
                    "slot": 1,
                    "clientId": 81234
                  }
                ],
                "approvalComment": "Client meeting in Prague"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sent.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "sent": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "trip": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "title": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Code `13` / `14`: no token, token invalid, or a widget token."
          },
          "403": {
            "description": "Code `139`: the OAuth token lacks scope `orders:write`."
          },
          "409": {
            "description": "Code `5`: there is no cart to send."
          },
          "422": {
            "description": "`{\"errors\": {...}}`: the trip needs no approval (book it), or the traveller/buyer data is refused."
          }
        }
      }
    },
    "/v1/rate-guard/settings": {
      "get": {
        "tags": [
          "Rate Guard"
        ],
        "summary": "Get Rate Guard settings",
        "description": "Rate Guard watches the company's booked hotel stays that can still be cancelled free of charge and looks for a cheaper rate. These settings decide when it emails about a price drop, when it rebooks on its own, and who approves actions on bookings.\n\nAlways the caller's own company, resolved from the token; there is no company parameter. A caller with no company gets the platform defaults. Read `permissions` to know which sections the caller may change.\n\n**Who may call:** company roles DIRECTOR, TRAVEL_MANAGER and TMC_ADMIN (a partner travel company's admin). Employees and travellers get `403`.\n\n**Auth:** JWT or OAuth access token. An API token is **not** accepted (`401`).",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "email": {
                      "type": "object",
                      "properties": {
                        "enabled": {
                          "type": "boolean",
                          "description": "Send price-drop notification emails."
                        },
                        "savingPercent": {
                          "type": "number",
                          "description": "Minimum saving, as a percentage of the booking price (0–100).",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "savingAmountUsd": {
                          "type": "number",
                          "description": "Minimum saving in USD.",
                          "minimum": 0
                        },
                        "maxEarlierCancelShiftDays": {
                          "type": "integer",
                          "description": "How many days earlier the cheaper rate's free-cancellation deadline may fall than the current booking's.",
                          "minimum": 0
                        },
                        "minDaysBeforeCheckin": {
                          "type": "integer",
                          "description": "Do not act when check-in is closer than this many days.",
                          "minimum": 0
                        }
                      },
                      "description": "Price-drop notifications, sent when a cheaper rate is found for a booked hotel stay that can still be cancelled free of charge."
                    },
                    "autoRebook": {
                      "type": "object",
                      "properties": {
                        "enabled": {
                          "type": "boolean",
                          "description": "Rebook automatically to the cheaper rate."
                        },
                        "savingPercent": {
                          "type": "number",
                          "description": "Minimum saving, as a percentage of the booking price (0–100).",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "savingAmountUsd": {
                          "type": "number",
                          "description": "Minimum saving in USD.",
                          "minimum": 0
                        },
                        "maxEarlierCancelShiftDays": {
                          "type": "integer",
                          "description": "How many days earlier the cheaper rate's free-cancellation deadline may fall than the current booking's.",
                          "minimum": 0
                        },
                        "minDaysBeforeCheckin": {
                          "type": "integer",
                          "description": "Do not act when check-in is closer than this many days.",
                          "minimum": 0
                        },
                        "approvalMode": {
                          "type": "string",
                          "enum": [
                            "auto",
                            "traveler",
                            "manager",
                            "traveler_then_manager"
                          ],
                          "description": "Who confirms the action. `auto`: runs on its own when within the section's limits (otherwise the person who asked confirms); `traveler`: the person who asked confirms; `manager`: a manager of the company confirms; `traveler_then_manager`: the person who asked, then a manager. With `enabled: false`, `auto` behaves as `traveler`."
                        },
                        "maxGrossUsd": {
                          "type": "number",
                          "description": "Upper limit of the booking price (USD) for automatic rebooking.",
                          "minimum": 0
                        }
                      },
                      "description": "Automatic rebooking to a cheaper rate."
                    },
                    "actions": {
                      "type": "object",
                      "properties": {
                        "cancel": {
                          "type": "object",
                          "properties": {
                            "enabled": {
                              "type": "boolean",
                              "description": "Let the action run without a person when the rule allows it. Off by default."
                            },
                            "approvalMode": {
                              "type": "string",
                              "enum": [
                                "auto",
                                "traveler",
                                "manager",
                                "traveler_then_manager"
                              ],
                              "description": "Who confirms the action. `auto`: runs on its own when within the section's limits (otherwise the person who asked confirms); `traveler`: the person who asked confirms; `manager`: a manager of the company confirms; `traveler_then_manager`: the person who asked, then a manager. With `enabled: false`, `auto` behaves as `traveler`."
                            },
                            "maxPenaltyUsd": {
                              "type": "number",
                              "description": "Largest cancellation fee (USD) the rule accepts on its own.",
                              "minimum": 0
                            },
                            "maxPenaltyPercent": {
                              "type": "number",
                              "description": "Largest cancellation fee as a percentage of the booking price (0–100).",
                              "minimum": 0,
                              "maximum": 100
                            },
                            "minDaysBeforeStart": {
                              "type": "integer",
                              "description": "The rule approves on its own only when the service starts at least this many days ahead; 0 = no limit.",
                              "minimum": 0
                            }
                          },
                          "description": "Cancelling a booking."
                        },
                        "change": {
                          "type": "object",
                          "properties": {
                            "enabled": {
                              "type": "boolean",
                              "description": "Let the action run without a person when the rule allows it. Off by default."
                            },
                            "approvalMode": {
                              "type": "string",
                              "enum": [
                                "auto",
                                "traveler",
                                "manager",
                                "traveler_then_manager"
                              ],
                              "description": "Who confirms the action. `auto`: runs on its own when within the section's limits (otherwise the person who asked confirms); `traveler`: the person who asked confirms; `manager`: a manager of the company confirms; `traveler_then_manager`: the person who asked, then a manager. With `enabled: false`, `auto` behaves as `traveler`."
                            },
                            "maxSurchargeUsd": {
                              "type": "number",
                              "description": "Largest extra payment (USD) the rule accepts on its own.",
                              "minimum": 0
                            },
                            "maxSurchargePercent": {
                              "type": "number",
                              "description": "Largest extra payment as a percentage of the booking price (0–100).",
                              "minimum": 0,
                              "maximum": 100
                            },
                            "minDaysBeforeStart": {
                              "type": "integer",
                              "description": "The rule approves on its own only when the service starts at least this many days ahead; 0 = no limit.",
                              "minimum": 0
                            },
                            "priceDriftPercent": {
                              "type": "number",
                              "description": "How far (percent) the final price may move from the chosen quote without asking again (0–100).",
                              "minimum": 0,
                              "maximum": 100
                            }
                          },
                          "description": "Changing a booking."
                        },
                        "refundRequest": {
                          "type": "object",
                          "properties": {
                            "enabled": {
                              "type": "boolean",
                              "description": "Let the action run without a person when the rule allows it. Off by default."
                            },
                            "approvalMode": {
                              "type": "string",
                              "enum": [
                                "auto",
                                "traveler",
                                "manager",
                                "traveler_then_manager"
                              ],
                              "description": "Who confirms the action. `auto`: runs on its own when within the section's limits (otherwise the person who asked confirms); `traveler`: the person who asked confirms; `manager`: a manager of the company confirms; `traveler_then_manager`: the person who asked, then a manager. With `enabled: false`, `auto` behaves as `traveler`."
                            },
                            "minAmountUsd": {
                              "type": "number",
                              "description": "Smallest amount (USD) worth requesting.",
                              "minimum": 0
                            }
                          },
                          "description": "Requesting a refund from the supplier."
                        },
                        "taxRefundClaim": {
                          "type": "object",
                          "properties": {
                            "enabled": {
                              "type": "boolean",
                              "description": "Let the action run without a person when the rule allows it. Off by default."
                            },
                            "approvalMode": {
                              "type": "string",
                              "enum": [
                                "auto",
                                "traveler",
                                "manager",
                                "traveler_then_manager"
                              ],
                              "description": "Who confirms the action. `auto`: runs on its own when within the section's limits (otherwise the person who asked confirms); `traveler`: the person who asked confirms; `manager`: a manager of the company confirms; `traveler_then_manager`: the person who asked, then a manager. With `enabled: false`, `auto` behaves as `traveler`."
                            },
                            "minAmountUsd": {
                              "type": "number",
                              "description": "Smallest amount (USD) worth claiming.",
                              "minimum": 0
                            }
                          },
                          "description": "Claiming a tax refund."
                        }
                      },
                      "description": "Approval rules for actions with a financial effect on bookings. Editable only when the plan includes external booking management (`company_rate_guard.actions_edit`)."
                    },
                    "defaults": {
                      "type": "object",
                      "properties": {
                        "email": {
                          "type": "object",
                          "properties": {
                            "enabled": {
                              "type": "boolean",
                              "description": "Send price-drop notification emails."
                            },
                            "savingPercent": {
                              "type": "number",
                              "description": "Minimum saving, as a percentage of the booking price (0–100).",
                              "minimum": 0,
                              "maximum": 100
                            },
                            "savingAmountUsd": {
                              "type": "number",
                              "description": "Minimum saving in USD.",
                              "minimum": 0
                            },
                            "maxEarlierCancelShiftDays": {
                              "type": "integer",
                              "description": "How many days earlier the cheaper rate's free-cancellation deadline may fall than the current booking's.",
                              "minimum": 0
                            },
                            "minDaysBeforeCheckin": {
                              "type": "integer",
                              "description": "Do not act when check-in is closer than this many days.",
                              "minimum": 0
                            }
                          },
                          "description": "Price-drop notifications, sent when a cheaper rate is found for a booked hotel stay that can still be cancelled free of charge."
                        },
                        "autoRebook": {
                          "type": "object",
                          "properties": {
                            "enabled": {
                              "type": "boolean",
                              "description": "Rebook automatically to the cheaper rate."
                            },
                            "savingPercent": {
                              "type": "number",
                              "description": "Minimum saving, as a percentage of the booking price (0–100).",
                              "minimum": 0,
                              "maximum": 100
                            },
                            "savingAmountUsd": {
                              "type": "number",
                              "description": "Minimum saving in USD.",
                              "minimum": 0
                            },
                            "maxEarlierCancelShiftDays": {
                              "type": "integer",
                              "description": "How many days earlier the cheaper rate's free-cancellation deadline may fall than the current booking's.",
                              "minimum": 0
                            },
                            "minDaysBeforeCheckin": {
                              "type": "integer",
                              "description": "Do not act when check-in is closer than this many days.",
                              "minimum": 0
                            },
                            "approvalMode": {
                              "type": "string",
                              "enum": [
                                "auto",
                                "traveler",
                                "manager",
                                "traveler_then_manager"
                              ],
                              "description": "Who confirms the action. `auto`: runs on its own when within the section's limits (otherwise the person who asked confirms); `traveler`: the person who asked confirms; `manager`: a manager of the company confirms; `traveler_then_manager`: the person who asked, then a manager. With `enabled: false`, `auto` behaves as `traveler`."
                            },
                            "maxGrossUsd": {
                              "type": "number",
                              "description": "Upper limit of the booking price (USD) for automatic rebooking.",
                              "minimum": 0
                            }
                          },
                          "description": "Automatic rebooking to a cheaper rate."
                        },
                        "cancel": {
                          "type": "object",
                          "properties": {
                            "enabled": {
                              "type": "boolean",
                              "description": "Let the action run without a person when the rule allows it. Off by default."
                            },
                            "approvalMode": {
                              "type": "string",
                              "enum": [
                                "auto",
                                "traveler",
                                "manager",
                                "traveler_then_manager"
                              ],
                              "description": "Who confirms the action. `auto`: runs on its own when within the section's limits (otherwise the person who asked confirms); `traveler`: the person who asked confirms; `manager`: a manager of the company confirms; `traveler_then_manager`: the person who asked, then a manager. With `enabled: false`, `auto` behaves as `traveler`."
                            },
                            "maxPenaltyUsd": {
                              "type": "number",
                              "description": "Largest cancellation fee (USD) the rule accepts on its own.",
                              "minimum": 0
                            },
                            "maxPenaltyPercent": {
                              "type": "number",
                              "description": "Largest cancellation fee as a percentage of the booking price (0–100).",
                              "minimum": 0,
                              "maximum": 100
                            },
                            "minDaysBeforeStart": {
                              "type": "integer",
                              "description": "The rule approves on its own only when the service starts at least this many days ahead; 0 = no limit.",
                              "minimum": 0
                            }
                          },
                          "description": "Cancelling a booking."
                        },
                        "change": {
                          "type": "object",
                          "properties": {
                            "enabled": {
                              "type": "boolean",
                              "description": "Let the action run without a person when the rule allows it. Off by default."
                            },
                            "approvalMode": {
                              "type": "string",
                              "enum": [
                                "auto",
                                "traveler",
                                "manager",
                                "traveler_then_manager"
                              ],
                              "description": "Who confirms the action. `auto`: runs on its own when within the section's limits (otherwise the person who asked confirms); `traveler`: the person who asked confirms; `manager`: a manager of the company confirms; `traveler_then_manager`: the person who asked, then a manager. With `enabled: false`, `auto` behaves as `traveler`."
                            },
                            "maxSurchargeUsd": {
                              "type": "number",
                              "description": "Largest extra payment (USD) the rule accepts on its own.",
                              "minimum": 0
                            },
                            "maxSurchargePercent": {
                              "type": "number",
                              "description": "Largest extra payment as a percentage of the booking price (0–100).",
                              "minimum": 0,
                              "maximum": 100
                            },
                            "minDaysBeforeStart": {
                              "type": "integer",
                              "description": "The rule approves on its own only when the service starts at least this many days ahead; 0 = no limit.",
                              "minimum": 0
                            },
                            "priceDriftPercent": {
                              "type": "number",
                              "description": "How far (percent) the final price may move from the chosen quote without asking again (0–100).",
                              "minimum": 0,
                              "maximum": 100
                            }
                          },
                          "description": "Changing a booking."
                        },
                        "refundRequest": {
                          "type": "object",
                          "properties": {
                            "enabled": {
                              "type": "boolean",
                              "description": "Let the action run without a person when the rule allows it. Off by default."
                            },
                            "approvalMode": {
                              "type": "string",
                              "enum": [
                                "auto",
                                "traveler",
                                "manager",
                                "traveler_then_manager"
                              ],
                              "description": "Who confirms the action. `auto`: runs on its own when within the section's limits (otherwise the person who asked confirms); `traveler`: the person who asked confirms; `manager`: a manager of the company confirms; `traveler_then_manager`: the person who asked, then a manager. With `enabled: false`, `auto` behaves as `traveler`."
                            },
                            "minAmountUsd": {
                              "type": "number",
                              "description": "Smallest amount (USD) worth requesting.",
                              "minimum": 0
                            }
                          },
                          "description": "Requesting a refund from the supplier."
                        },
                        "taxRefundClaim": {
                          "type": "object",
                          "properties": {
                            "enabled": {
                              "type": "boolean",
                              "description": "Let the action run without a person when the rule allows it. Off by default."
                            },
                            "approvalMode": {
                              "type": "string",
                              "enum": [
                                "auto",
                                "traveler",
                                "manager",
                                "traveler_then_manager"
                              ],
                              "description": "Who confirms the action. `auto`: runs on its own when within the section's limits (otherwise the person who asked confirms); `traveler`: the person who asked confirms; `manager`: a manager of the company confirms; `traveler_then_manager`: the person who asked, then a manager. With `enabled: false`, `auto` behaves as `traveler`."
                            },
                            "minAmountUsd": {
                              "type": "number",
                              "description": "Smallest amount (USD) worth claiming.",
                              "minimum": 0
                            }
                          },
                          "description": "Claiming a tax refund."
                        }
                      },
                      "description": "Platform defaults for every section. Note: here the four action sections sit at the top level, not under `actions`. A field sent as `null` falls back to its default."
                    },
                    "permissions": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "company_rate_guard.edit",
                          "company_rate_guard.actions_edit"
                        ]
                      },
                      "description": "What the caller may change: `company_rate_guard.edit` = `email` and `autoRebook` (the plan includes Rate Guard); `company_rate_guard.actions_edit` = the `actions` sections (the plan includes external booking management)."
                    },
                    "updatedAt": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "Unix time of the last change; `null` while the company runs on defaults."
                    },
                    "updatedBy": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "User id of whoever made the last change."
                    }
                  },
                  "description": "Rate Guard settings of the caller's company."
                },
                "example": {
                  "email": {
                    "enabled": true,
                    "savingPercent": 2.0,
                    "savingAmountUsd": 9.99,
                    "maxEarlierCancelShiftDays": 5,
                    "minDaysBeforeCheckin": 1
                  },
                  "autoRebook": {
                    "enabled": true,
                    "savingPercent": 0.0,
                    "savingAmountUsd": 15.0,
                    "maxEarlierCancelShiftDays": 0,
                    "minDaysBeforeCheckin": 2,
                    "approvalMode": "auto",
                    "maxGrossUsd": 1000.0
                  },
                  "actions": {
                    "cancel": {
                      "enabled": false,
                      "approvalMode": "traveler",
                      "maxPenaltyUsd": 0.0,
                      "maxPenaltyPercent": 0.0,
                      "minDaysBeforeStart": 0
                    },
                    "change": {
                      "enabled": false,
                      "approvalMode": "traveler",
                      "maxSurchargeUsd": 0.0,
                      "maxSurchargePercent": 0.0,
                      "minDaysBeforeStart": 0,
                      "priceDriftPercent": 5.0
                    },
                    "refundRequest": {
                      "enabled": false,
                      "approvalMode": "traveler",
                      "minAmountUsd": 20.0
                    },
                    "taxRefundClaim": {
                      "enabled": false,
                      "approvalMode": "traveler",
                      "minAmountUsd": 20.0
                    }
                  },
                  "defaults": {
                    "email": {
                      "enabled": true,
                      "savingPercent": 2.0,
                      "savingAmountUsd": 9.99,
                      "maxEarlierCancelShiftDays": 5,
                      "minDaysBeforeCheckin": 1
                    },
                    "autoRebook": {
                      "enabled": true,
                      "savingPercent": 0.0,
                      "savingAmountUsd": 15.0,
                      "maxEarlierCancelShiftDays": 0,
                      "minDaysBeforeCheckin": 2,
                      "approvalMode": "auto",
                      "maxGrossUsd": 1000.0
                    },
                    "cancel": {
                      "enabled": false,
                      "approvalMode": "traveler",
                      "maxPenaltyUsd": 0.0,
                      "maxPenaltyPercent": 0.0,
                      "minDaysBeforeStart": 0
                    },
                    "change": {
                      "enabled": false,
                      "approvalMode": "traveler",
                      "maxSurchargeUsd": 0.0,
                      "maxSurchargePercent": 0.0,
                      "minDaysBeforeStart": 0,
                      "priceDriftPercent": 5.0
                    },
                    "refundRequest": {
                      "enabled": false,
                      "approvalMode": "traveler",
                      "minAmountUsd": 20.0
                    },
                    "taxRefundClaim": {
                      "enabled": false,
                      "approvalMode": "traveler",
                      "minAmountUsd": 20.0
                    }
                  },
                  "permissions": [
                    "company_rate_guard.edit"
                  ],
                  "updatedAt": null,
                  "updatedBy": null
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token, or an API token (not accepted here)."
          },
          "403": {
            "description": "Code `6`: the caller's role may not open Rate Guard settings."
          }
        }
      },
      "put": {
        "tags": [
          "Rate Guard"
        ],
        "summary": "Update Rate Guard settings",
        "description": "Partial update: send only the sections and fields to change; anything omitted keeps its value. `null` (or an empty string) resets a field to its default. Send `enabled` as a JSON boolean. Unknown fields are ignored. Returns the full settings after saving.\n\n**Plan rules:** changing `email` or `autoRebook` needs Rate Guard in the plan (`company_rate_guard.edit`); changing any `actions` section needs external booking management in the plan (`company_rate_guard.actions_edit`). If any section in the body is not allowed, the whole request is refused with `403` and nothing is saved.\n\n**Validation:** percentages 0–100; amounts and day counts ≥ 0 (day counts are integers); `approvalMode` one of the listed values. Keys in a `422` are storage names, which differ from the request fields outside `email`: `autoRebook.savingPercent` → `rebookSavingPercent`, `autoRebook.approvalMode` → `rebookApprovalMode`, `actions.cancel.maxPenaltyUsd` → `cancelMaxPenaltyUsd`, `actions.change.approvalMode` → `changeApprovalMode`, and so on.\n\n**Who may call:** company roles DIRECTOR, TRAVEL_MANAGER and TMC_ADMIN (a partner travel company's admin). Employees and travellers get `403`. The caller must belong to a company of his account.\n\n**Auth:** JWT or OAuth access token. An API token is **not** accepted (`401`).",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "object",
                    "properties": {
                      "enabled": {
                        "type": "boolean",
                        "description": "Send price-drop notification emails."
                      },
                      "savingPercent": {
                        "type": "number",
                        "description": "Minimum saving, as a percentage of the booking price (0–100).",
                        "minimum": 0,
                        "maximum": 100
                      },
                      "savingAmountUsd": {
                        "type": "number",
                        "description": "Minimum saving in USD.",
                        "minimum": 0
                      },
                      "maxEarlierCancelShiftDays": {
                        "type": "integer",
                        "description": "How many days earlier the cheaper rate's free-cancellation deadline may fall than the current booking's.",
                        "minimum": 0
                      },
                      "minDaysBeforeCheckin": {
                        "type": "integer",
                        "description": "Do not act when check-in is closer than this many days.",
                        "minimum": 0
                      }
                    },
                    "description": "Price-drop notifications, sent when a cheaper rate is found for a booked hotel stay that can still be cancelled free of charge."
                  },
                  "autoRebook": {
                    "type": "object",
                    "properties": {
                      "enabled": {
                        "type": "boolean",
                        "description": "Rebook automatically to the cheaper rate."
                      },
                      "savingPercent": {
                        "type": "number",
                        "description": "Minimum saving, as a percentage of the booking price (0–100).",
                        "minimum": 0,
                        "maximum": 100
                      },
                      "savingAmountUsd": {
                        "type": "number",
                        "description": "Minimum saving in USD.",
                        "minimum": 0
                      },
                      "maxEarlierCancelShiftDays": {
                        "type": "integer",
                        "description": "How many days earlier the cheaper rate's free-cancellation deadline may fall than the current booking's.",
                        "minimum": 0
                      },
                      "minDaysBeforeCheckin": {
                        "type": "integer",
                        "description": "Do not act when check-in is closer than this many days.",
                        "minimum": 0
                      },
                      "approvalMode": {
                        "type": "string",
                        "enum": [
                          "auto",
                          "traveler",
                          "manager",
                          "traveler_then_manager"
                        ],
                        "description": "Who confirms the action. `auto`: runs on its own when within the section's limits (otherwise the person who asked confirms); `traveler`: the person who asked confirms; `manager`: a manager of the company confirms; `traveler_then_manager`: the person who asked, then a manager. With `enabled: false`, `auto` behaves as `traveler`."
                      },
                      "maxGrossUsd": {
                        "type": "number",
                        "description": "Upper limit of the booking price (USD) for automatic rebooking.",
                        "minimum": 0
                      }
                    },
                    "description": "Automatic rebooking to a cheaper rate."
                  },
                  "actions": {
                    "type": "object",
                    "properties": {
                      "cancel": {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean",
                            "description": "Let the action run without a person when the rule allows it. Off by default."
                          },
                          "approvalMode": {
                            "type": "string",
                            "enum": [
                              "auto",
                              "traveler",
                              "manager",
                              "traveler_then_manager"
                            ],
                            "description": "Who confirms the action. `auto`: runs on its own when within the section's limits (otherwise the person who asked confirms); `traveler`: the person who asked confirms; `manager`: a manager of the company confirms; `traveler_then_manager`: the person who asked, then a manager. With `enabled: false`, `auto` behaves as `traveler`."
                          },
                          "maxPenaltyUsd": {
                            "type": "number",
                            "description": "Largest cancellation fee (USD) the rule accepts on its own.",
                            "minimum": 0
                          },
                          "maxPenaltyPercent": {
                            "type": "number",
                            "description": "Largest cancellation fee as a percentage of the booking price (0–100).",
                            "minimum": 0,
                            "maximum": 100
                          },
                          "minDaysBeforeStart": {
                            "type": "integer",
                            "description": "The rule approves on its own only when the service starts at least this many days ahead; 0 = no limit.",
                            "minimum": 0
                          }
                        },
                        "description": "Cancelling a booking."
                      },
                      "change": {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean",
                            "description": "Let the action run without a person when the rule allows it. Off by default."
                          },
                          "approvalMode": {
                            "type": "string",
                            "enum": [
                              "auto",
                              "traveler",
                              "manager",
                              "traveler_then_manager"
                            ],
                            "description": "Who confirms the action. `auto`: runs on its own when within the section's limits (otherwise the person who asked confirms); `traveler`: the person who asked confirms; `manager`: a manager of the company confirms; `traveler_then_manager`: the person who asked, then a manager. With `enabled: false`, `auto` behaves as `traveler`."
                          },
                          "maxSurchargeUsd": {
                            "type": "number",
                            "description": "Largest extra payment (USD) the rule accepts on its own.",
                            "minimum": 0
                          },
                          "maxSurchargePercent": {
                            "type": "number",
                            "description": "Largest extra payment as a percentage of the booking price (0–100).",
                            "minimum": 0,
                            "maximum": 100
                          },
                          "minDaysBeforeStart": {
                            "type": "integer",
                            "description": "The rule approves on its own only when the service starts at least this many days ahead; 0 = no limit.",
                            "minimum": 0
                          },
                          "priceDriftPercent": {
                            "type": "number",
                            "description": "How far (percent) the final price may move from the chosen quote without asking again (0–100).",
                            "minimum": 0,
                            "maximum": 100
                          }
                        },
                        "description": "Changing a booking."
                      },
                      "refundRequest": {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean",
                            "description": "Let the action run without a person when the rule allows it. Off by default."
                          },
                          "approvalMode": {
                            "type": "string",
                            "enum": [
                              "auto",
                              "traveler",
                              "manager",
                              "traveler_then_manager"
                            ],
                            "description": "Who confirms the action. `auto`: runs on its own when within the section's limits (otherwise the person who asked confirms); `traveler`: the person who asked confirms; `manager`: a manager of the company confirms; `traveler_then_manager`: the person who asked, then a manager. With `enabled: false`, `auto` behaves as `traveler`."
                          },
                          "minAmountUsd": {
                            "type": "number",
                            "description": "Smallest amount (USD) worth requesting.",
                            "minimum": 0
                          }
                        },
                        "description": "Requesting a refund from the supplier."
                      },
                      "taxRefundClaim": {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean",
                            "description": "Let the action run without a person when the rule allows it. Off by default."
                          },
                          "approvalMode": {
                            "type": "string",
                            "enum": [
                              "auto",
                              "traveler",
                              "manager",
                              "traveler_then_manager"
                            ],
                            "description": "Who confirms the action. `auto`: runs on its own when within the section's limits (otherwise the person who asked confirms); `traveler`: the person who asked confirms; `manager`: a manager of the company confirms; `traveler_then_manager`: the person who asked, then a manager. With `enabled: false`, `auto` behaves as `traveler`."
                          },
                          "minAmountUsd": {
                            "type": "number",
                            "description": "Smallest amount (USD) worth claiming.",
                            "minimum": 0
                          }
                        },
                        "description": "Claiming a tax refund."
                      }
                    },
                    "description": "Approval rules for actions with a financial effect on bookings. Editable only when the plan includes external booking management (`company_rate_guard.actions_edit`)."
                  }
                },
                "description": "Any subset of the sections and fields."
              },
              "example": {
                "email": {
                  "enabled": true,
                  "savingPercent": 3,
                  "savingAmountUsd": 20
                },
                "autoRebook": {
                  "enabled": false
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "email": {
                      "type": "object",
                      "properties": {
                        "enabled": {
                          "type": "boolean",
                          "description": "Send price-drop notification emails."
                        },
                        "savingPercent": {
                          "type": "number",
                          "description": "Minimum saving, as a percentage of the booking price (0–100).",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "savingAmountUsd": {
                          "type": "number",
                          "description": "Minimum saving in USD.",
                          "minimum": 0
                        },
                        "maxEarlierCancelShiftDays": {
                          "type": "integer",
                          "description": "How many days earlier the cheaper rate's free-cancellation deadline may fall than the current booking's.",
                          "minimum": 0
                        },
                        "minDaysBeforeCheckin": {
                          "type": "integer",
                          "description": "Do not act when check-in is closer than this many days.",
                          "minimum": 0
                        }
                      },
                      "description": "Price-drop notifications, sent when a cheaper rate is found for a booked hotel stay that can still be cancelled free of charge."
                    },
                    "autoRebook": {
                      "type": "object",
                      "properties": {
                        "enabled": {
                          "type": "boolean",
                          "description": "Rebook automatically to the cheaper rate."
                        },
                        "savingPercent": {
                          "type": "number",
                          "description": "Minimum saving, as a percentage of the booking price (0–100).",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "savingAmountUsd": {
                          "type": "number",
                          "description": "Minimum saving in USD.",
                          "minimum": 0
                        },
                        "maxEarlierCancelShiftDays": {
                          "type": "integer",
                          "description": "How many days earlier the cheaper rate's free-cancellation deadline may fall than the current booking's.",
                          "minimum": 0
                        },
                        "minDaysBeforeCheckin": {
                          "type": "integer",
                          "description": "Do not act when check-in is closer than this many days.",
                          "minimum": 0
                        },
                        "approvalMode": {
                          "type": "string",
                          "enum": [
                            "auto",
                            "traveler",
                            "manager",
                            "traveler_then_manager"
                          ],
                          "description": "Who confirms the action. `auto`: runs on its own when within the section's limits (otherwise the person who asked confirms); `traveler`: the person who asked confirms; `manager`: a manager of the company confirms; `traveler_then_manager`: the person who asked, then a manager. With `enabled: false`, `auto` behaves as `traveler`."
                        },
                        "maxGrossUsd": {
                          "type": "number",
                          "description": "Upper limit of the booking price (USD) for automatic rebooking.",
                          "minimum": 0
                        }
                      },
                      "description": "Automatic rebooking to a cheaper rate."
                    },
                    "actions": {
                      "type": "object",
                      "properties": {
                        "cancel": {
                          "type": "object",
                          "properties": {
                            "enabled": {
                              "type": "boolean",
                              "description": "Let the action run without a person when the rule allows it. Off by default."
                            },
                            "approvalMode": {
                              "type": "string",
                              "enum": [
                                "auto",
                                "traveler",
                                "manager",
                                "traveler_then_manager"
                              ],
                              "description": "Who confirms the action. `auto`: runs on its own when within the section's limits (otherwise the person who asked confirms); `traveler`: the person who asked confirms; `manager`: a manager of the company confirms; `traveler_then_manager`: the person who asked, then a manager. With `enabled: false`, `auto` behaves as `traveler`."
                            },
                            "maxPenaltyUsd": {
                              "type": "number",
                              "description": "Largest cancellation fee (USD) the rule accepts on its own.",
                              "minimum": 0
                            },
                            "maxPenaltyPercent": {
                              "type": "number",
                              "description": "Largest cancellation fee as a percentage of the booking price (0–100).",
                              "minimum": 0,
                              "maximum": 100
                            },
                            "minDaysBeforeStart": {
                              "type": "integer",
                              "description": "The rule approves on its own only when the service starts at least this many days ahead; 0 = no limit.",
                              "minimum": 0
                            }
                          },
                          "description": "Cancelling a booking."
                        },
                        "change": {
                          "type": "object",
                          "properties": {
                            "enabled": {
                              "type": "boolean",
                              "description": "Let the action run without a person when the rule allows it. Off by default."
                            },
                            "approvalMode": {
                              "type": "string",
                              "enum": [
                                "auto",
                                "traveler",
                                "manager",
                                "traveler_then_manager"
                              ],
                              "description": "Who confirms the action. `auto`: runs on its own when within the section's limits (otherwise the person who asked confirms); `traveler`: the person who asked confirms; `manager`: a manager of the company confirms; `traveler_then_manager`: the person who asked, then a manager. With `enabled: false`, `auto` behaves as `traveler`."
                            },
                            "maxSurchargeUsd": {
                              "type": "number",
                              "description": "Largest extra payment (USD) the rule accepts on its own.",
                              "minimum": 0
                            },
                            "maxSurchargePercent": {
                              "type": "number",
                              "description": "Largest extra payment as a percentage of the booking price (0–100).",
                              "minimum": 0,
                              "maximum": 100
                            },
                            "minDaysBeforeStart": {
                              "type": "integer",
                              "description": "The rule approves on its own only when the service starts at least this many days ahead; 0 = no limit.",
                              "minimum": 0
                            },
                            "priceDriftPercent": {
                              "type": "number",
                              "description": "How far (percent) the final price may move from the chosen quote without asking again (0–100).",
                              "minimum": 0,
                              "maximum": 100
                            }
                          },
                          "description": "Changing a booking."
                        },
                        "refundRequest": {
                          "type": "object",
                          "properties": {
                            "enabled": {
                              "type": "boolean",
                              "description": "Let the action run without a person when the rule allows it. Off by default."
                            },
                            "approvalMode": {
                              "type": "string",
                              "enum": [
                                "auto",
                                "traveler",
                                "manager",
                                "traveler_then_manager"
                              ],
                              "description": "Who confirms the action. `auto`: runs on its own when within the section's limits (otherwise the person who asked confirms); `traveler`: the person who asked confirms; `manager`: a manager of the company confirms; `traveler_then_manager`: the person who asked, then a manager. With `enabled: false`, `auto` behaves as `traveler`."
                            },
                            "minAmountUsd": {
                              "type": "number",
                              "description": "Smallest amount (USD) worth requesting.",
                              "minimum": 0
                            }
                          },
                          "description": "Requesting a refund from the supplier."
                        },
                        "taxRefundClaim": {
                          "type": "object",
                          "properties": {
                            "enabled": {
                              "type": "boolean",
                              "description": "Let the action run without a person when the rule allows it. Off by default."
                            },
                            "approvalMode": {
                              "type": "string",
                              "enum": [
                                "auto",
                                "traveler",
                                "manager",
                                "traveler_then_manager"
                              ],
                              "description": "Who confirms the action. `auto`: runs on its own when within the section's limits (otherwise the person who asked confirms); `traveler`: the person who asked confirms; `manager`: a manager of the company confirms; `traveler_then_manager`: the person who asked, then a manager. With `enabled: false`, `auto` behaves as `traveler`."
                            },
                            "minAmountUsd": {
                              "type": "number",
                              "description": "Smallest amount (USD) worth claiming.",
                              "minimum": 0
                            }
                          },
                          "description": "Claiming a tax refund."
                        }
                      },
                      "description": "Approval rules for actions with a financial effect on bookings. Editable only when the plan includes external booking management (`company_rate_guard.actions_edit`)."
                    },
                    "defaults": {
                      "type": "object",
                      "properties": {
                        "email": {
                          "type": "object",
                          "properties": {
                            "enabled": {
                              "type": "boolean",
                              "description": "Send price-drop notification emails."
                            },
                            "savingPercent": {
                              "type": "number",
                              "description": "Minimum saving, as a percentage of the booking price (0–100).",
                              "minimum": 0,
                              "maximum": 100
                            },
                            "savingAmountUsd": {
                              "type": "number",
                              "description": "Minimum saving in USD.",
                              "minimum": 0
                            },
                            "maxEarlierCancelShiftDays": {
                              "type": "integer",
                              "description": "How many days earlier the cheaper rate's free-cancellation deadline may fall than the current booking's.",
                              "minimum": 0
                            },
                            "minDaysBeforeCheckin": {
                              "type": "integer",
                              "description": "Do not act when check-in is closer than this many days.",
                              "minimum": 0
                            }
                          },
                          "description": "Price-drop notifications, sent when a cheaper rate is found for a booked hotel stay that can still be cancelled free of charge."
                        },
                        "autoRebook": {
                          "type": "object",
                          "properties": {
                            "enabled": {
                              "type": "boolean",
                              "description": "Rebook automatically to the cheaper rate."
                            },
                            "savingPercent": {
                              "type": "number",
                              "description": "Minimum saving, as a percentage of the booking price (0–100).",
                              "minimum": 0,
                              "maximum": 100
                            },
                            "savingAmountUsd": {
                              "type": "number",
                              "description": "Minimum saving in USD.",
                              "minimum": 0
                            },
                            "maxEarlierCancelShiftDays": {
                              "type": "integer",
                              "description": "How many days earlier the cheaper rate's free-cancellation deadline may fall than the current booking's.",
                              "minimum": 0
                            },
                            "minDaysBeforeCheckin": {
                              "type": "integer",
                              "description": "Do not act when check-in is closer than this many days.",
                              "minimum": 0
                            },
                            "approvalMode": {
                              "type": "string",
                              "enum": [
                                "auto",
                                "traveler",
                                "manager",
                                "traveler_then_manager"
                              ],
                              "description": "Who confirms the action. `auto`: runs on its own when within the section's limits (otherwise the person who asked confirms); `traveler`: the person who asked confirms; `manager`: a manager of the company confirms; `traveler_then_manager`: the person who asked, then a manager. With `enabled: false`, `auto` behaves as `traveler`."
                            },
                            "maxGrossUsd": {
                              "type": "number",
                              "description": "Upper limit of the booking price (USD) for automatic rebooking.",
                              "minimum": 0
                            }
                          },
                          "description": "Automatic rebooking to a cheaper rate."
                        },
                        "cancel": {
                          "type": "object",
                          "properties": {
                            "enabled": {
                              "type": "boolean",
                              "description": "Let the action run without a person when the rule allows it. Off by default."
                            },
                            "approvalMode": {
                              "type": "string",
                              "enum": [
                                "auto",
                                "traveler",
                                "manager",
                                "traveler_then_manager"
                              ],
                              "description": "Who confirms the action. `auto`: runs on its own when within the section's limits (otherwise the person who asked confirms); `traveler`: the person who asked confirms; `manager`: a manager of the company confirms; `traveler_then_manager`: the person who asked, then a manager. With `enabled: false`, `auto` behaves as `traveler`."
                            },
                            "maxPenaltyUsd": {
                              "type": "number",
                              "description": "Largest cancellation fee (USD) the rule accepts on its own.",
                              "minimum": 0
                            },
                            "maxPenaltyPercent": {
                              "type": "number",
                              "description": "Largest cancellation fee as a percentage of the booking price (0–100).",
                              "minimum": 0,
                              "maximum": 100
                            },
                            "minDaysBeforeStart": {
                              "type": "integer",
                              "description": "The rule approves on its own only when the service starts at least this many days ahead; 0 = no limit.",
                              "minimum": 0
                            }
                          },
                          "description": "Cancelling a booking."
                        },
                        "change": {
                          "type": "object",
                          "properties": {
                            "enabled": {
                              "type": "boolean",
                              "description": "Let the action run without a person when the rule allows it. Off by default."
                            },
                            "approvalMode": {
                              "type": "string",
                              "enum": [
                                "auto",
                                "traveler",
                                "manager",
                                "traveler_then_manager"
                              ],
                              "description": "Who confirms the action. `auto`: runs on its own when within the section's limits (otherwise the person who asked confirms); `traveler`: the person who asked confirms; `manager`: a manager of the company confirms; `traveler_then_manager`: the person who asked, then a manager. With `enabled: false`, `auto` behaves as `traveler`."
                            },
                            "maxSurchargeUsd": {
                              "type": "number",
                              "description": "Largest extra payment (USD) the rule accepts on its own.",
                              "minimum": 0
                            },
                            "maxSurchargePercent": {
                              "type": "number",
                              "description": "Largest extra payment as a percentage of the booking price (0–100).",
                              "minimum": 0,
                              "maximum": 100
                            },
                            "minDaysBeforeStart": {
                              "type": "integer",
                              "description": "The rule approves on its own only when the service starts at least this many days ahead; 0 = no limit.",
                              "minimum": 0
                            },
                            "priceDriftPercent": {
                              "type": "number",
                              "description": "How far (percent) the final price may move from the chosen quote without asking again (0–100).",
                              "minimum": 0,
                              "maximum": 100
                            }
                          },
                          "description": "Changing a booking."
                        },
                        "refundRequest": {
                          "type": "object",
                          "properties": {
                            "enabled": {
                              "type": "boolean",
                              "description": "Let the action run without a person when the rule allows it. Off by default."
                            },
                            "approvalMode": {
                              "type": "string",
                              "enum": [
                                "auto",
                                "traveler",
                                "manager",
                                "traveler_then_manager"
                              ],
                              "description": "Who confirms the action. `auto`: runs on its own when within the section's limits (otherwise the person who asked confirms); `traveler`: the person who asked confirms; `manager`: a manager of the company confirms; `traveler_then_manager`: the person who asked, then a manager. With `enabled: false`, `auto` behaves as `traveler`."
                            },
                            "minAmountUsd": {
                              "type": "number",
                              "description": "Smallest amount (USD) worth requesting.",
                              "minimum": 0
                            }
                          },
                          "description": "Requesting a refund from the supplier."
                        },
                        "taxRefundClaim": {
                          "type": "object",
                          "properties": {
                            "enabled": {
                              "type": "boolean",
                              "description": "Let the action run without a person when the rule allows it. Off by default."
                            },
                            "approvalMode": {
                              "type": "string",
                              "enum": [
                                "auto",
                                "traveler",
                                "manager",
                                "traveler_then_manager"
                              ],
                              "description": "Who confirms the action. `auto`: runs on its own when within the section's limits (otherwise the person who asked confirms); `traveler`: the person who asked confirms; `manager`: a manager of the company confirms; `traveler_then_manager`: the person who asked, then a manager. With `enabled: false`, `auto` behaves as `traveler`."
                            },
                            "minAmountUsd": {
                              "type": "number",
                              "description": "Smallest amount (USD) worth claiming.",
                              "minimum": 0
                            }
                          },
                          "description": "Claiming a tax refund."
                        }
                      },
                      "description": "Platform defaults for every section. Note: here the four action sections sit at the top level, not under `actions`. A field sent as `null` falls back to its default."
                    },
                    "permissions": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "company_rate_guard.edit",
                          "company_rate_guard.actions_edit"
                        ]
                      },
                      "description": "What the caller may change: `company_rate_guard.edit` = `email` and `autoRebook` (the plan includes Rate Guard); `company_rate_guard.actions_edit` = the `actions` sections (the plan includes external booking management)."
                    },
                    "updatedAt": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "Unix time of the last change; `null` while the company runs on defaults."
                    },
                    "updatedBy": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "User id of whoever made the last change."
                    }
                  },
                  "description": "Rate Guard settings of the caller's company."
                },
                "example": {
                  "email": {
                    "enabled": true,
                    "savingPercent": 3.0,
                    "savingAmountUsd": 20.0,
                    "maxEarlierCancelShiftDays": 5,
                    "minDaysBeforeCheckin": 1
                  },
                  "autoRebook": {
                    "enabled": false,
                    "savingPercent": 0.0,
                    "savingAmountUsd": 15.0,
                    "maxEarlierCancelShiftDays": 0,
                    "minDaysBeforeCheckin": 2,
                    "approvalMode": "auto",
                    "maxGrossUsd": 1000.0
                  },
                  "actions": {
                    "cancel": {
                      "enabled": false,
                      "approvalMode": "traveler",
                      "maxPenaltyUsd": 0.0,
                      "maxPenaltyPercent": 0.0,
                      "minDaysBeforeStart": 0
                    },
                    "change": {
                      "enabled": false,
                      "approvalMode": "traveler",
                      "maxSurchargeUsd": 0.0,
                      "maxSurchargePercent": 0.0,
                      "minDaysBeforeStart": 0,
                      "priceDriftPercent": 5.0
                    },
                    "refundRequest": {
                      "enabled": false,
                      "approvalMode": "traveler",
                      "minAmountUsd": 20.0
                    },
                    "taxRefundClaim": {
                      "enabled": false,
                      "approvalMode": "traveler",
                      "minAmountUsd": 20.0
                    }
                  },
                  "defaults": {
                    "email": {
                      "enabled": true,
                      "savingPercent": 2.0,
                      "savingAmountUsd": 9.99,
                      "maxEarlierCancelShiftDays": 5,
                      "minDaysBeforeCheckin": 1
                    },
                    "autoRebook": {
                      "enabled": true,
                      "savingPercent": 0.0,
                      "savingAmountUsd": 15.0,
                      "maxEarlierCancelShiftDays": 0,
                      "minDaysBeforeCheckin": 2,
                      "approvalMode": "auto",
                      "maxGrossUsd": 1000.0
                    },
                    "cancel": {
                      "enabled": false,
                      "approvalMode": "traveler",
                      "maxPenaltyUsd": 0.0,
                      "maxPenaltyPercent": 0.0,
                      "minDaysBeforeStart": 0
                    },
                    "change": {
                      "enabled": false,
                      "approvalMode": "traveler",
                      "maxSurchargeUsd": 0.0,
                      "maxSurchargePercent": 0.0,
                      "minDaysBeforeStart": 0,
                      "priceDriftPercent": 5.0
                    },
                    "refundRequest": {
                      "enabled": false,
                      "approvalMode": "traveler",
                      "minAmountUsd": 20.0
                    },
                    "taxRefundClaim": {
                      "enabled": false,
                      "approvalMode": "traveler",
                      "minAmountUsd": 20.0
                    }
                  },
                  "permissions": [
                    "company_rate_guard.edit"
                  ],
                  "updatedAt": 1764841200,
                  "updatedBy": 48211
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token, or an API token (not accepted here)."
          },
          "403": {
            "description": "Code `6`: the role may not edit, the plan lacks the feature a section in the body needs, or the caller belongs to no company."
          },
          "422": {
            "description": "Validation failed. Nothing is saved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "errors": {
                      "type": "object",
                      "description": "Storage field name => messages.",
                      "additionalProperties": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "errors": {
                    "rebookSavingPercent": [
                      "Rebook Saving Percent must be no greater than 100."
                    ]
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/co2/emissions": {
      "get": {
        "tags": [
          "CO2"
        ],
        "summary": "CO2 emissions report",
        "description": "CO2e emitted by the trips of the caller's company in a period: total, trend against the previous period, breakdown by travel type, top travellers and top flight routes, plus the whole platform's total for comparison (one anonymous number, never another company's details).\n\nCovers flights, hotels, rail, bus, ferry, car and transfers. Flights count by flight date, other services by service date. Amounts are kg CO2e. `own` is `null` when the caller belongs to no company.\n\n**Who may call:** any user of a company with the Analytics module on (`403`, code `130`, otherwise). There is no role restriction: every company user can read the company's figures, including traveller names in `topEmitters`.\n\n**Auth:** JWT, OAuth access token or API token.",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": []
          }
        ],
        "parameters": [
          {
            "name": "dateFrom",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Period start, `YYYY-MM-DD`. Default: 12 months ago. A malformed date is replaced by the default, not refused."
          },
          {
            "name": "dateTo",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Period end, inclusive, `YYYY-MM-DD`. Default: today."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 10
            },
            "description": "Rows in `topEmitters` and `topRoutes`; clamped to 1–50."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "period": {
                      "type": "object",
                      "properties": {
                        "dateFrom": {
                          "type": "string",
                          "description": "Applied period start.",
                          "format": "date"
                        },
                        "dateTo": {
                          "type": "string",
                          "description": "Applied period end.",
                          "format": "date"
                        }
                      }
                    },
                    "own": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "totalKg": {
                          "type": "number",
                          "description": "Company total, kg CO2e."
                        },
                        "previousPeriodKg": {
                          "type": "number",
                          "description": "Total for the period of the same length right before, kg CO2e."
                        },
                        "breakdownByType": {
                          "type": "array",
                          "description": "Largest first; empty when the total is 0.",
                          "items": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "description": "Travel type.",
                                "enum": [
                                  "flights",
                                  "hotel",
                                  "rail",
                                  "bus",
                                  "ferry",
                                  "car",
                                  "transfer"
                                ]
                              },
                              "co2Kg": {
                                "type": "number",
                                "description": "kg CO2e."
                              },
                              "percent": {
                                "type": "number",
                                "description": "Share of the company total, percent."
                              }
                            }
                          }
                        },
                        "topEmitters": {
                          "type": "array",
                          "description": "Travellers (the people who travelled, not who booked) with the most CO2e, largest first.",
                          "items": {
                            "type": "object",
                            "properties": {
                              "clientOrderId": {
                                "type": "integer",
                                "description": "Traveller record id."
                              },
                              "name": {
                                "type": "string",
                                "description": "Traveller's name (`ID <clientOrderId>` when no name is known)."
                              },
                              "co2Kg": {
                                "type": "number",
                                "description": "The traveller's own share, kg CO2e."
                              }
                            }
                          }
                        },
                        "topRoutes": {
                          "type": "array",
                          "description": "Flight routes only, largest first.",
                          "items": {
                            "type": "object",
                            "properties": {
                              "departureAirport": {
                                "type": "string",
                                "description": "IATA code."
                              },
                              "arrivalAirport": {
                                "type": "string",
                                "description": "IATA code."
                              },
                              "co2Kg": {
                                "type": "number",
                                "description": "kg CO2e on this route."
                              },
                              "flightsCount": {
                                "type": "integer",
                                "description": "Flight segments counted."
                              }
                            }
                          }
                        }
                      },
                      "description": "The caller's company; `null` when the caller has no company."
                    },
                    "platform": {
                      "type": "object",
                      "properties": {
                        "totalKg": {
                          "type": "number",
                          "description": "Whole-platform total for the same period, kg CO2e."
                        }
                      }
                    }
                  }
                },
                "example": {
                  "period": {
                    "dateFrom": "2025-12-04",
                    "dateTo": "2026-12-04"
                  },
                  "own": {
                    "totalKg": 18342.512,
                    "previousPeriodKg": 20110.004,
                    "breakdownByType": [
                      {
                        "type": "flights",
                        "co2Kg": 16120.3,
                        "percent": 87.9
                      },
                      {
                        "type": "hotel",
                        "co2Kg": 1980.112,
                        "percent": 10.8
                      },
                      {
                        "type": "rail",
                        "co2Kg": 242.1,
                        "percent": 1.3
                      }
                    ],
                    "topEmitters": [
                      {
                        "clientOrderId": 48211,
                        "name": "Anna Smith",
                        "co2Kg": 2210.4
                      }
                    ],
                    "topRoutes": [
                      {
                        "departureAirport": "LHR",
                        "arrivalAirport": "JFK",
                        "co2Kg": 3120.75,
                        "flightsCount": 6
                      }
                    ]
                  },
                  "platform": {
                    "totalKg": 5120443.871
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token."
          },
          "403": {
            "description": "Code `130`: the Analytics module is off for the company."
          }
        }
      }
    },
    "/v1/co2/factors": {
      "get": {
        "tags": [
          "CO2"
        ],
        "summary": "List emission factors",
        "description": "The emission factors used to calculate CO2e for rail, bus, ferry, hotel, car and transfer services (newest version of each platform factor), each with the company's own value if it set one. Flights use a separate method and are not listed.\n\n**Who may call:** company roles DIRECTOR, TRAVEL_MANAGER and TMC_ADMIN; employees and travellers get `403`. The company must have the Analytics module on (`403`, code `130`, otherwise).\n\n**Auth:** JWT or OAuth access token. An API token is **not** accepted (`401`).",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "factors": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "mode": {
                            "type": "string",
                            "description": "Travel type.",
                            "enum": [
                              "rail",
                              "bus",
                              "ferry",
                              "hotel",
                              "car",
                              "transfer"
                            ]
                          },
                          "factorKey": {
                            "type": "string",
                            "description": "What the factor applies to: `country:XX` (ISO country), `region:…`, `class:…` or `default`."
                          },
                          "unit": {
                            "type": "string",
                            "description": "`kgCO2e_per_pkm` (per passenger-km), `kgCO2e_per_vkm` (per vehicle-km) or `kgCO2e_per_room_night`."
                          },
                          "platformValue": {
                            "type": "number",
                            "description": "The platform's value."
                          },
                          "source": {
                            "type": "string",
                            "description": "Source of the platform value, e.g. `DESNZ-2025`, `MOBITOOL-3.1`."
                          },
                          "sourceVersion": {
                            "type": "string",
                            "description": "Source version."
                          },
                          "qualityTier": {
                            "type": "integer",
                            "description": "1 = country/specific, 2 = region, 3 = global default."
                          },
                          "companyValue": {
                            "type": [
                              "number",
                              "null"
                            ],
                            "description": "The company's own value, used instead of `platformValue`; `null` when not set."
                          }
                        }
                      }
                    },
                    "permissions": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "company_co2.edit"
                        ]
                      },
                      "description": "`company_co2.edit` when the caller may change factors and settings (he belongs to a company of his account)."
                    }
                  }
                },
                "example": {
                  "factors": [
                    {
                      "mode": "rail",
                      "factorKey": "country:DE",
                      "unit": "kgCO2e_per_pkm",
                      "platformValue": 0.032,
                      "source": "MOBITOOL-3.1",
                      "sourceVersion": "2024",
                      "qualityTier": 1,
                      "companyValue": null
                    }
                  ],
                  "permissions": [
                    "company_co2.edit"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token, or an API token (not accepted here)."
          },
          "403": {
            "description": "Code `6`: the role may not open CO2 settings. Code `130`: the Analytics module is off."
          }
        }
      },
      "put": {
        "tags": [
          "CO2"
        ],
        "summary": "Set or remove a company emission factor",
        "description": "Sets the company's own value for one platform factor, or removes it with `value: null`. The company's existing CO2 figures are then recalculated in the background (`recalculating: true`), so the emissions report may lag for a while.\n\n**Who may call:** company roles DIRECTOR, TRAVEL_MANAGER and TMC_ADMIN; employees and travellers get `403`. The company must have the Analytics module on (`403`, code `130`, otherwise). The caller must belong to a company of his account.\n\n**Auth:** JWT or OAuth access token. An API token is **not** accepted (`401`).",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "mode": {
                    "type": "string",
                    "description": "`mode` of a factor from `GET /v1/co2/factors`."
                  },
                  "factorKey": {
                    "type": "string",
                    "description": "`factorKey` of that factor."
                  },
                  "value": {
                    "type": [
                      "number",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 1000,
                    "description": "New value in the factor's `unit` (0–1000), or `null` to go back to the platform value."
                  }
                },
                "required": [
                  "mode",
                  "factorKey"
                ]
              },
              "example": {
                "mode": "rail",
                "factorKey": "country:DE",
                "value": 0.028
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "factors": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "mode": {
                            "type": "string",
                            "description": "Travel type.",
                            "enum": [
                              "rail",
                              "bus",
                              "ferry",
                              "hotel",
                              "car",
                              "transfer"
                            ]
                          },
                          "factorKey": {
                            "type": "string",
                            "description": "What the factor applies to: `country:XX` (ISO country), `region:…`, `class:…` or `default`."
                          },
                          "unit": {
                            "type": "string",
                            "description": "`kgCO2e_per_pkm` (per passenger-km), `kgCO2e_per_vkm` (per vehicle-km) or `kgCO2e_per_room_night`."
                          },
                          "platformValue": {
                            "type": "number",
                            "description": "The platform's value."
                          },
                          "source": {
                            "type": "string",
                            "description": "Source of the platform value, e.g. `DESNZ-2025`, `MOBITOOL-3.1`."
                          },
                          "sourceVersion": {
                            "type": "string",
                            "description": "Source version."
                          },
                          "qualityTier": {
                            "type": "integer",
                            "description": "1 = country/specific, 2 = region, 3 = global default."
                          },
                          "companyValue": {
                            "type": [
                              "number",
                              "null"
                            ],
                            "description": "The company's own value, used instead of `platformValue`; `null` when not set."
                          }
                        }
                      }
                    },
                    "recalculating": {
                      "type": "boolean",
                      "const": true
                    }
                  }
                },
                "example": {
                  "factors": [
                    {
                      "mode": "rail",
                      "factorKey": "country:DE",
                      "unit": "kgCO2e_per_pkm",
                      "platformValue": 0.032,
                      "source": "MOBITOOL-3.1",
                      "sourceVersion": "2024",
                      "qualityTier": 1,
                      "companyValue": 0.028
                    }
                  ],
                  "recalculating": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token, or an API token (not accepted here)."
          },
          "403": {
            "description": "Code `6`: the role may not change CO2 settings, or the caller belongs to no company. Code `130`: the Analytics module is off."
          },
          "422": {
            "description": "Validation failed. Nothing is saved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "errors": {
                      "type": "object",
                      "description": "Field path => message.",
                      "additionalProperties": {
                        "type": "string"
                      }
                    }
                  }
                },
                "example": {
                  "errors": {
                    "factorKey": "Unknown emission factor."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/co2/settings": {
      "get": {
        "tags": [
          "CO2"
        ],
        "summary": "Get CO2 settings",
        "description": "The company's climate goal and its \"rail instead of flight\" thresholds. A caller with no company gets the defaults.\n\n**Who may call:** company roles DIRECTOR, TRAVEL_MANAGER and TMC_ADMIN; employees and travellers get `403`. The company must have the Analytics module on (`403`, code `130`, otherwise).\n\n**Auth:** JWT or OAuth access token. An API token is **not** accepted (`401`).",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "climateGoal": {
                      "type": "object",
                      "properties": {
                        "percent": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "description": "Target CO2e reduction, percent (above 0, up to 100); `null` = no goal."
                        },
                        "baselineYear": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "description": "Year the reduction is measured against (2015 – current year). Required when `percent` is set."
                        }
                      },
                      "description": "The company's climate goal, shown against its CO2 report."
                    },
                    "railAlternative": {
                      "type": "object",
                      "properties": {
                        "mode": {
                          "type": "string",
                          "description": "What the Travel Code web flight search does when a train is a reasonable alternative: `off` — nothing; `mark` — point out the train; `hide` — hide the flights.",
                          "enum": [
                            "off",
                            "mark",
                            "hide"
                          ]
                        },
                        "maxKm": {
                          "type": "integer",
                          "description": "Only routes up to this distance, km (50–3000)."
                        },
                        "maxHours": {
                          "type": "number",
                          "description": "Only trains up to this travel time, hours (1–24)."
                        },
                        "maxPricePercent": {
                          "type": "integer",
                          "description": "Only trains at most this much dearer than the cheapest flight, percent (0–300)."
                        }
                      },
                      "description": "\"Rail instead of flight\" thresholds."
                    },
                    "defaults": {
                      "type": "object",
                      "properties": {
                        "mode": {
                          "type": "string"
                        },
                        "maxKm": {
                          "type": "integer"
                        },
                        "maxHours": {
                          "type": "number"
                        },
                        "maxPricePercent": {
                          "type": "integer"
                        }
                      },
                      "description": "Platform defaults for `railAlternative`."
                    },
                    "permissions": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "company_co2.edit"
                        ]
                      },
                      "description": "`company_co2.edit` when the caller may change factors and settings (he belongs to a company of his account)."
                    },
                    "updatedAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Time of the last change, `YYYY-MM-DD HH:MM:SS`; `null` while the company runs on defaults."
                    }
                  }
                },
                "example": {
                  "climateGoal": {
                    "percent": 20.0,
                    "baselineYear": 2024
                  },
                  "railAlternative": {
                    "mode": "mark",
                    "maxKm": 800,
                    "maxHours": 6.0,
                    "maxPricePercent": 30
                  },
                  "defaults": {
                    "mode": "mark",
                    "maxKm": 800,
                    "maxHours": 6.0,
                    "maxPricePercent": 30
                  },
                  "permissions": [
                    "company_co2.edit"
                  ],
                  "updatedAt": "2026-11-20 09:14:03"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token, or an API token (not accepted here)."
          },
          "403": {
            "description": "Code `6`: the role may not open CO2 settings. Code `130`: the Analytics module is off."
          }
        }
      },
      "put": {
        "tags": [
          "CO2"
        ],
        "summary": "Update CO2 settings",
        "description": "Partial update: send `climateGoal` and/or `railAlternative` with only the fields to change; the rest keep their values. To clear the goal send `{\"climateGoal\": {\"percent\": null, \"baselineYear\": null}}`. The merged result is validated as a whole; returns the settings after saving.\n\nThe `railAlternative` thresholds drive the train suggestion in the Travel Code web flight search; flight search results returned by the API are not filtered by them.\n\n**Who may call:** company roles DIRECTOR, TRAVEL_MANAGER and TMC_ADMIN; employees and travellers get `403`. The company must have the Analytics module on (`403`, code `130`, otherwise). The caller must belong to a company of his account.\n\n**Auth:** JWT or OAuth access token. An API token is **not** accepted (`401`).",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "climateGoal": {
                    "type": "object",
                    "properties": {
                      "percent": {
                        "type": [
                          "number",
                          "null"
                        ],
                        "description": "Target CO2e reduction, percent (above 0, up to 100); `null` = no goal."
                      },
                      "baselineYear": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "description": "Year the reduction is measured against (2015 – current year). Required when `percent` is set."
                      }
                    }
                  },
                  "railAlternative": {
                    "type": "object",
                    "properties": {
                      "mode": {
                        "type": "string",
                        "description": "What the Travel Code web flight search does when a train is a reasonable alternative: `off` — nothing; `mark` — point out the train; `hide` — hide the flights.",
                        "enum": [
                          "off",
                          "mark",
                          "hide"
                        ]
                      },
                      "maxKm": {
                        "type": "integer",
                        "description": "Only routes up to this distance, km (50–3000)."
                      },
                      "maxHours": {
                        "type": "number",
                        "description": "Only trains up to this travel time, hours (1–24)."
                      },
                      "maxPricePercent": {
                        "type": "integer",
                        "description": "Only trains at most this much dearer than the cheapest flight, percent (0–300)."
                      }
                    }
                  }
                },
                "description": "Any subset of the fields; same limits as in the response."
              },
              "example": {
                "climateGoal": {
                  "percent": 20,
                  "baselineYear": 2024
                },
                "railAlternative": {
                  "mode": "hide",
                  "maxKm": 600
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "climateGoal": {
                      "type": "object",
                      "properties": {
                        "percent": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "description": "Target CO2e reduction, percent (above 0, up to 100); `null` = no goal."
                        },
                        "baselineYear": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "description": "Year the reduction is measured against (2015 – current year). Required when `percent` is set."
                        }
                      },
                      "description": "The company's climate goal, shown against its CO2 report."
                    },
                    "railAlternative": {
                      "type": "object",
                      "properties": {
                        "mode": {
                          "type": "string",
                          "description": "What the Travel Code web flight search does when a train is a reasonable alternative: `off` — nothing; `mark` — point out the train; `hide` — hide the flights.",
                          "enum": [
                            "off",
                            "mark",
                            "hide"
                          ]
                        },
                        "maxKm": {
                          "type": "integer",
                          "description": "Only routes up to this distance, km (50–3000)."
                        },
                        "maxHours": {
                          "type": "number",
                          "description": "Only trains up to this travel time, hours (1–24)."
                        },
                        "maxPricePercent": {
                          "type": "integer",
                          "description": "Only trains at most this much dearer than the cheapest flight, percent (0–300)."
                        }
                      },
                      "description": "\"Rail instead of flight\" thresholds."
                    },
                    "defaults": {
                      "type": "object",
                      "properties": {
                        "mode": {
                          "type": "string"
                        },
                        "maxKm": {
                          "type": "integer"
                        },
                        "maxHours": {
                          "type": "number"
                        },
                        "maxPricePercent": {
                          "type": "integer"
                        }
                      },
                      "description": "Platform defaults for `railAlternative`."
                    },
                    "permissions": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "company_co2.edit"
                        ]
                      },
                      "description": "`company_co2.edit` when the caller may change factors and settings (he belongs to a company of his account)."
                    },
                    "updatedAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Time of the last change, `YYYY-MM-DD HH:MM:SS`; `null` while the company runs on defaults."
                    }
                  }
                },
                "example": {
                  "climateGoal": {
                    "percent": 20.0,
                    "baselineYear": 2024
                  },
                  "railAlternative": {
                    "mode": "hide",
                    "maxKm": 600,
                    "maxHours": 6.0,
                    "maxPricePercent": 30
                  },
                  "defaults": {
                    "mode": "mark",
                    "maxKm": 800,
                    "maxHours": 6.0,
                    "maxPricePercent": 30
                  },
                  "permissions": [
                    "company_co2.edit"
                  ],
                  "updatedAt": "2026-11-20 09:14:03"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token, or an API token (not accepted here)."
          },
          "403": {
            "description": "Code `6`: the role may not change CO2 settings, or the caller belongs to no company. Code `130`: the Analytics module is off."
          },
          "422": {
            "description": "Validation failed. Nothing is saved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "errors": {
                      "type": "object",
                      "description": "Field path => message.",
                      "additionalProperties": {
                        "type": "string"
                      }
                    }
                  }
                },
                "example": {
                  "errors": {
                    "climateGoal.baselineYear": "Pick the baseline year the reduction is measured against.",
                    "railAlternative.maxKm": "Distance must be between 50 and 3000 km."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/reports": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "List reports available to the caller",
        "description": "The analytics reports the caller can open, filtered by role, company modules and plan. Open one with `GET /v1/reports/{id}`.\n\n**Who can open which report** (company roles; this list already hides what the caller cannot open):\n\n| Report id | What it shows | Roles |\n|---|---|---|\n| `co2-emissions` | CO2 footprint of business travel by type, month, traveller, department and route; platform benchmark. | Every role. Director, travel manager, accountant, top manager and TMC admin see every employee of their company; other roles see only their own trips. A director of several legal entities can pick entities. |\n| `policy-health` | Travel-policy rules ranked by how often bookings breach them. | Director, travel manager. |\n| `rate-guard-savings` | Money RateGuard returned to the deposit by rebooking hotels at cheaper rates (client refund only). | Director, travel manager, TMC admin. Listed only while the plan includes RateGuard or the company already has refunds. |\n| `per-diem` | Per-diem allowances of expense reports, day by day, by month, legal entity, department and country. | Director, top manager, accountant, travel manager. Needs the Expenses module. Rows are limited to the caller's companies. |\n| `contract-performance` | What negotiated (contract) air fares saved or cost against the public fares on the same flights. | Director, travel manager. |\n| `most-booked-hotels` | Most booked hotels, spend and average nightly rate in USD, to pick rate-negotiation candidates. | Director (all own legal entities), TMC admin (own storefront's orders). |\n\nEvery report also needs the company's **Analytics** module; with it off the analytics endpoints answer `403` with code `130`.",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": []
          }
        ],
        "parameters": [
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "en",
                "ru"
              ]
            },
            "description": "Language of titles, labels and descriptions: `en` (default) or `ru`."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "title": {
                        "type": "string"
                      },
                      "description": {
                        "type": "string"
                      },
                      "group": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "description": "Navigation group: `orders`, `hotels`, `travel-policy`, `expenses`."
                      }
                    }
                  }
                },
                "example": [
                  {
                    "id": "co2-emissions",
                    "title": "CO2 Emissions",
                    "description": "Your company's carbon footprint from business travel, and how it compares to the whole platform.",
                    "group": "orders"
                  },
                  {
                    "id": "policy-health",
                    "title": "Travel Policy Health",
                    "description": "Policy rules ranked by how often bookings breach them.",
                    "group": "travel-policy"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "Code `13`: no token. Code `14`: invalid or expired token, or a token type this endpoint does not take (JWT or OAuth only)."
          },
          "403": {
            "description": "Code `130`: the company's Analytics module is off."
          }
        }
      }
    },
    "/v1/reports/{id}": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Report definition: filters, elements, sections",
        "description": "Everything needed to render a report for this caller: the filters with their options and resolved defaults, and the elements (KPI tiles, charts, tables) whose data is fetched one by one from `GET /v1/reports/{id}/elements/{elementId}`.\n\nOptions of company / employee / department filters are already narrowed to the caller's scope. For a filter with `depends_on`, pass the parent value in the query (e.g. `?company=12,15`) to get the matching child options.\n\nReport ids and who may open them: see `GET /v1/reports`.",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[\\w\\-]+$"
            },
            "description": "Report id from `GET /v1/reports`, e.g. `co2-emissions`.",
            "example": "co2-emissions"
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "en",
                "ru"
              ]
            },
            "description": "Language of titles, labels and descriptions: `en` (default) or `ru`."
          },
          {
            "name": "company",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Optional: current value of a parent filter, to narrow the options of filters that `depends_on` it. Any filter id can be passed the same way.",
            "example": "12,15"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "example": "co2-emissions"
                    },
                    "group": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "example": "orders"
                    },
                    "title": {
                      "type": "string",
                      "example": "CO2 Emissions"
                    },
                    "description": {
                      "type": "string"
                    },
                    "filters": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "description": "A filter control. Send its value on element requests as described under `GET /v1/reports/{id}/elements/{elementId}`.",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Query parameter name, except `date_range` (sent as `date_from` / `date_to`) and `month` (sent as `month`)."
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "date_range",
                              "month",
                              "multi_select",
                              "select",
                              "number",
                              "boolean"
                            ]
                          },
                          "label": {
                            "type": "string"
                          },
                          "default": {
                            "description": "Default value. For `date_range` an object `{preset, date_from, date_to}` already resolved to dates; for `month` `{preset, month}`."
                          },
                          "source": {
                            "type": "string",
                            "description": "Where the options come from (`analytics_companies`, `employees`, `countries`, ...). Informational."
                          },
                          "options": {
                            "type": "array",
                            "description": "Allowed values for `multi_select` / `select`, already narrowed to the caller's scope. A filter with fewer than two options for this caller is left out of `filters` entirely.",
                            "items": {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "label": {
                                  "type": "string"
                                },
                                "default": {
                                  "type": "boolean"
                                }
                              }
                            }
                          },
                          "depends_on": {
                            "type": "string",
                            "description": "Id of the filter whose value narrows these options. Re-read the report with that value in the query (e.g. `?company=12`) to get the narrowed options."
                          },
                          "hidden": {
                            "type": "boolean",
                            "description": "Accepted as a parameter but has no control on the page (set by a section or a drill-in)."
                          },
                          "min_month": {
                            "type": "string",
                            "description": "`month` filters only: earliest month with data, `YYYY-MM`."
                          }
                        },
                        "required": [
                          "id",
                          "type"
                        ]
                      }
                    },
                    "layout": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "description": "One block of the report. Fetch its data with `GET /v1/reports/{id}/elements/{elementId}`.",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "The `elementId`."
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "banner",
                              "counter_group",
                              "breakdown",
                              "table",
                              "bar_chart",
                              "line_chart",
                              "series_bar_chart"
                            ],
                            "description": "Decides the shape of the element's `data`."
                          },
                          "title": {
                            "type": "string"
                          },
                          "width": {
                            "type": "string",
                            "description": "Layout hint on a 12-column grid: `1`, `1/2`, `1/3`, `2/3`, `1/4`, `3/4`."
                          },
                          "tiles": {
                            "type": "array",
                            "description": "`counter_group` / `breakdown`: the figures, in display order.",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "description": "Key of the figure in `data`."
                                },
                                "label": {
                                  "type": "string"
                                },
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "money",
                                    "percent",
                                    "number"
                                  ]
                                },
                                "sparkline": {
                                  "type": "boolean",
                                  "description": "`data.trends[id]` carries a series for a mini chart."
                                }
                              }
                            }
                          },
                          "columns": {
                            "type": "array",
                            "description": "`table`: the columns, in display order.",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "description": "Key of the value in each row."
                                },
                                "label": {
                                  "type": "string"
                                },
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "money",
                                    "number",
                                    "boolean"
                                  ]
                                },
                                "sortable": {
                                  "type": "boolean",
                                  "description": "May be sent as `sort` for a server-paged table."
                                },
                                "hidden": {
                                  "type": "boolean",
                                  "description": "Present in rows (as a drill-in key or a link) but not displayed."
                                },
                                "link_field": {
                                  "type": "string",
                                  "description": "Column holding a URL for this cell."
                                }
                              }
                            }
                          },
                          "label_field": {
                            "type": "string",
                            "description": "Charts: key of the label in each data row."
                          },
                          "value_field": {
                            "type": "string",
                            "description": "`bar_chart` / `line_chart`: key of the value in each data row."
                          },
                          "value_type": {
                            "type": "string",
                            "description": "`money` when chart values are amounts."
                          },
                          "currency": {
                            "type": "string"
                          },
                          "pagination": {
                            "type": "string",
                            "enum": [
                              "client",
                              "server"
                            ],
                            "description": "`server`: the table is paged by the API (`page`, `sort`, `dir`, `search`). Default `client`: the whole table comes in one response."
                          },
                          "searchable": {
                            "type": "boolean"
                          },
                          "row_click": {
                            "type": "object",
                            "description": "Drill-in: a row click re-requests the `drill_in` elements with `<filter_by>=<row value>` in the query.",
                            "properties": {
                              "action": {
                                "type": "string",
                                "example": "drill_in"
                              },
                              "filter_by": {
                                "type": "string",
                                "example": "hotel_key"
                              }
                            }
                          }
                        },
                        "required": [
                          "id",
                          "type"
                        ]
                      },
                      "description": "Elements available to this caller. Elements the caller's plan does not include are left out (and answer `404`)."
                    },
                    "sections": {
                      "type": [
                        "array",
                        "null"
                      ],
                      "description": "Optional page menu: pages `{id, label, elements[], restricted}` or groups `{id, label, filters?, items[]}`. A group's `filters` (`{<filterId>: <value>}`) must be added to the element requests of its pages. `restricted: true` = the plan removed every element of the page.",
                      "items": {
                        "type": "object"
                      }
                    },
                    "drill_in": {
                      "type": "object",
                      "description": "Elements to show after a row click.",
                      "properties": {
                        "layout": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "what_why": {
                      "type": "object",
                      "description": "Explanatory texts: `what`, `why`, `how`.",
                      "additionalProperties": {
                        "type": "string"
                      }
                    },
                    "syncable": {
                      "type": "boolean",
                      "description": "Whether the dataset is refreshed by a background sync (used by the web UI)."
                    }
                  },
                  "required": [
                    "id",
                    "title",
                    "filters",
                    "layout"
                  ]
                },
                "example": {
                  "id": "policy-health",
                  "group": "travel-policy",
                  "title": "Travel Policy Health",
                  "description": "Policy rules ranked by how often bookings breach them.",
                  "filters": [
                    {
                      "id": "date_range",
                      "type": "date_range",
                      "label": "Date range",
                      "default": {
                        "preset": "LAST_30_DAYS",
                        "date_from": "2026-11-05",
                        "date_to": "2026-12-04"
                      }
                    },
                    {
                      "id": "threshold",
                      "type": "number",
                      "label": "Alert threshold, %",
                      "default": 20
                    }
                  ],
                  "layout": [
                    {
                      "id": "kpi-tiles",
                      "type": "counter_group",
                      "title": "Overview",
                      "tiles": [
                        {
                          "id": "affected_bookings",
                          "label": "Bookings under policy"
                        },
                        {
                          "id": "exceptions",
                          "label": "Out-of-policy"
                        },
                        {
                          "id": "approved",
                          "label": "Approved"
                        },
                        {
                          "id": "rejected",
                          "label": "Rejected"
                        }
                      ]
                    },
                    {
                      "id": "rules-table",
                      "type": "table",
                      "title": "Policy rules by exception rate",
                      "columns": [
                        {
                          "id": "policy_name",
                          "label": "Policy",
                          "sortable": true
                        },
                        {
                          "id": "exception_rate_pct",
                          "label": "Exception rate, %",
                          "type": "number",
                          "sortable": true
                        }
                      ]
                    }
                  ],
                  "sections": null,
                  "syncable": true
                }
              }
            }
          },
          "401": {
            "description": "Code `13`: no token. Code `14`: invalid or expired token, or a token type this endpoint does not take (JWT or OAuth only)."
          },
          "403": {
            "description": "Code `6`: the caller's role may not open this report, or a picked company / employee / department is outside the caller's scope. Code `130`: the company's Analytics module (Expenses for `per-diem`) is off."
          },
          "404": {
            "description": "Code `5`: unknown report id."
          }
        }
      }
    },
    "/v1/reports/{id}/elements/{elementId}": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Data of one report element",
        "description": "The data of one element (KPI tiles, chart or table) for the given filters. The same parameters apply to every element of a report: send the filter values the user picked, plus any `filters` of the active section and, for a drill-in, the row key (e.g. `hotel_key=g:12345` on `most-booked-hotels`).\n\n**Data scope.** Rows are always limited to what the caller may see: their own trips, or their company's for company management roles (see `GET /v1/reports`); a TMC admin sees only orders issued by their own storefront.\n\n**Money.** `most-booked-hotels`, `contract-performance` and `rate-guard-savings` report USD; `per-diem` reports each legal entity's currency.\n\n**Plan.** Elements the caller's plan does not include are absent from the report definition and answer `404`.\n\n**Example: `rate-guard-savings` elements** (all amounts USD; only rebookings that returned money to the company's deposit, no supplier or net-price figures; period = rebooking date, year to date by default):\n- `kpi-tiles` (`counter_group`): `{total_returned, total_rebooks, currency: \"USD\", trends: {total_returned: number[]|null}, trends_pct: {total_returned, total_rebooks}}`. `trends.total_returned` = weekly amounts, oldest first (`null` with fewer than two weeks); `trends_pct` = percent change against the equally long period right before (`null` when there is nothing to compare).\n- `returns-timeline` (`line_chart`): `[{month: \"YYYY-MM\", returned}]`, amount returned per month.\n- `returns-table` (`table`): newest first, at most 200 rows `{hotel_name, order_code, order_url, rebooked_at (YYYY-MM-DD), client_refund}`; `order_url` links to the order in the web app.\n- `subscription-banner` (`banner`): `{hidden: true}` when the plan includes Rate Guard, otherwise `{message, action: {label, href}}` pointing to the plans. The report stays readable after the plan loses Rate Guard, so past refunds remain visible.",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[\\w\\-]+$"
            },
            "description": "Report id from `GET /v1/reports`, e.g. `co2-emissions`.",
            "example": "co2-emissions"
          },
          {
            "name": "elementId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[\\w\\-]+$"
            },
            "description": "Element id from the report's `layout`, e.g. `kpi-tiles`.",
            "example": "kpi-tiles"
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "en",
                "ru"
              ]
            },
            "description": "Language of titles, labels and descriptions: `en` (default) or `ru`."
          },
          {
            "name": "date_from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Start of the period, `YYYY-MM-DD` (reports with a `date_range` filter). Without `date_from` / `date_to` the filter's default preset applies.",
            "example": "2026-01-01"
          },
          {
            "name": "date_to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "End of the period, `YYYY-MM-DD`, inclusive.",
            "example": "2026-12-04"
          },
          {
            "name": "month",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-(0[1-9]|1[0-2])$"
            },
            "description": "Reports with a `month` filter: `YYYY-MM`. An invalid value falls back to the filter's default."
          },
          {
            "name": "company",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Example of a filter parameter: every filter `id` from the report definition is passed the same way. `multi_select`: comma-separated values or repeated `company[]=`; `select`: one value; `number`: a number; `boolean`: `1` / `true` / `yes` / `on`. A pick outside the caller's scope answers `403` (code `6`) or is narrowed to the caller's companies.",
            "example": "12,15"
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0
            },
            "description": "Server-paged tables only (`pagination: server`): zero-based page, 20 rows per page. Without `page` the whole table is returned."
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Server-paged tables: a column id marked `sortable`; anything else is ignored.",
            "example": "total_spend"
          },
          {
            "name": "dir",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ],
              "default": "asc"
            },
            "description": "Server-paged tables: sort direction."
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Server-paged tables: text searched in every visible column."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "elementId": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "banner",
                        "counter_group",
                        "breakdown",
                        "table",
                        "bar_chart",
                        "line_chart",
                        "series_bar_chart"
                      ]
                    },
                    "data": {
                      "description": "Depends on `type`:\n- `counter_group` / `breakdown`: object `{<tileId>: number|string|null, currency?, trends?: {<tileId>: number[]|null}, trends_pct?: {<tileId>: number|null}}`.\n- `table`: array of rows `{<columnId>: scalar}`.\n- `bar_chart` / `line_chart`: array of `{<label_field>: string, <value_field>: number}` (`line_chart` labels are `YYYY-MM` or `YYYY-MM-DD`).\n- `series_bar_chart`: array of `{<label_field>: string, <seriesKey>: number, ...}`; the series are listed in `meta.series`.\n- `banner`: `{message?, action?: {label, href}}`, or `{hidden: true}` when there is nothing to show.",
                      "oneOf": [
                        {
                          "type": "object"
                        },
                        {
                          "type": "array",
                          "items": {
                            "type": "object"
                          }
                        }
                      ]
                    },
                    "meta": {
                      "type": "object",
                      "description": "Present for `series_bar_chart` (`series`, `currency`) and for server-paged tables (`total` rows matching `search`, `unfiltered_total`, `page_size`).",
                      "properties": {
                        "series": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "key": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "color": {
                                "type": "string"
                              }
                            }
                          }
                        },
                        "currency": {
                          "type": "string"
                        },
                        "total": {
                          "type": "integer"
                        },
                        "unfiltered_total": {
                          "type": "integer"
                        },
                        "page_size": {
                          "type": "integer",
                          "example": 20
                        }
                      }
                    }
                  },
                  "required": [
                    "elementId",
                    "type",
                    "data"
                  ]
                },
                "examples": {
                  "counter_group": {
                    "summary": "KPI tiles",
                    "value": {
                      "elementId": "kpi-tiles",
                      "type": "counter_group",
                      "data": {
                        "total_co2": 41.37,
                        "travellers": 21,
                        "trips": 37,
                        "kg_per_trip": 1118.1,
                        "precise_share": 86.4,
                        "vs_baseline": null,
                        "climate_goal": null,
                        "platform_total": 5120.4,
                        "trends_pct": {
                          "total_co2": -12.3
                        }
                      }
                    }
                  },
                  "table": {
                    "summary": "Table",
                    "value": {
                      "elementId": "top-routes",
                      "type": "table",
                      "data": [
                        {
                          "route": "LHR - JFK",
                          "flights": 6,
                          "co2_kg": 5320.4
                        }
                      ]
                    }
                  },
                  "series_bar_chart": {
                    "summary": "Series bar chart",
                    "value": {
                      "elementId": "monthly-by-type",
                      "type": "series_bar_chart",
                      "data": [
                        {
                          "month": "2026-10",
                          "flights": 3.42,
                          "hotel": 0.61,
                          "rail": 0.05
                        }
                      ],
                      "meta": {
                        "series": [
                          {
                            "key": "flights",
                            "label": "Flights",
                            "color": "#3B6FD8"
                          },
                          {
                            "key": "hotel",
                            "label": "Hotels",
                            "color": "#E8913F"
                          },
                          {
                            "key": "rail",
                            "label": "Rail",
                            "color": "#8B5CF6"
                          }
                        ]
                      }
                    }
                  },
                  "paged_table": {
                    "summary": "Server-paged table",
                    "value": {
                      "elementId": "hotels-table",
                      "type": "table",
                      "data": [
                        {
                          "hotel_key": "g:12345",
                          "hotel_name": "Hotel Example",
                          "country": "Germany",
                          "bookings_count": 14,
                          "total_spend": 5230.0,
                          "avg_rate": 121.6,
                          "has_active_contract": false
                        }
                      ],
                      "meta": {
                        "total": 57,
                        "unfiltered_total": 57,
                        "page_size": 20
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Code `20`: invalid filter value, e.g. a period longer than the report allows (`error.details.message` says why)."
          },
          "401": {
            "description": "Code `13`: no token. Code `14`: invalid or expired token, or a token type this endpoint does not take (JWT or OAuth only)."
          },
          "403": {
            "description": "Code `6`: the caller's role may not open this report, or a picked company / employee / department is outside the caller's scope. Code `130`: the company's Analytics module (Expenses for `per-diem`) is off."
          },
          "404": {
            "description": "Code `5`: unknown report, or the element is not in this caller's report (unknown id or not in the plan)."
          }
        }
      }
    },
    "/v1/report/order-registry": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Company order feed (order registry)",
        "description": "Machine-to-machine feed of the company's bookings for an accounting or travel-expense system: one row per service and traveller.\n\n**Auth: API token only.** Send the 48-character API token issued for your integration (ask your account manager) as `Authorization: Bearer <token>`; JWT and OAuth tokens are refused with `401` (code `14`). The token belongs to a user; the feed covers every order placed by any user of that user's company (legal entity).\n\n**Window: the last 45 days, sliding.** No paging and no date parameters. A row is included when its order is issued (status `finish`) and either the order was created within 45 days or the service changed within 45 days. Poll regularly (e.g. daily) and upsert by `operation_id`; a changed row (cancellation, refund) comes again with a later `last_modified_at`.\n\nExcluded: hidden and deleted services, and the per-segment child rows of a flight (the flight appears once). A refund or penalty is its own row (`operation_type` `refund` / `penalty`); a cancelled service keeps its row with `operation_type: cancellation`.\n\nMissing values are `null`, never an empty string. Amounts are the client price.\n\nNeeds the company's Analytics module (`403`, code `130`).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "timezone",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "IANA time zone for the system timestamps (`trip_created_at`, `last_modified_at`, `act_date`). Default: the platform time zone. Trip-local departure / arrival times are never shifted.",
            "example": "Europe/Berlin"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "operation_id": {
                            "type": "string",
                            "description": "Unique row id: `<serviceId>-<travellerId>`. Upsert by it.",
                            "example": "845123-99812"
                          },
                          "trip_id": {
                            "type": "string",
                            "description": "Order code.",
                            "example": "TC-61194"
                          },
                          "trip_created_at": {
                            "type": "string",
                            "description": "Order created, `DD.MM.YYYY HH:MM`, in `timezone` when given.",
                            "example": "02.11.2026 14:05"
                          },
                          "route_description": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Route as text."
                          },
                          "origin_location": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Departure point."
                          },
                          "destination_location": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Arrival point."
                          },
                          "departure_datetime": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Trip-local departure / check-in, `DD.MM.YYYY HH:MM`. Never shifted by `timezone`."
                          },
                          "arrival_datetime": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Trip-local arrival / check-out, `DD.MM.YYYY HH:MM`. For a multi-leg flight, the last leg's arrival."
                          },
                          "employee_code": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Reserved; always `null`."
                          },
                          "employee_name": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Traveller's full name."
                          },
                          "travel_document_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Number of the traveller's travel document used for the booking."
                          },
                          "operation_type": {
                            "type": "string",
                            "description": "What the row is.",
                            "enum": [
                              "booking",
                              "service_fee",
                              "refund",
                              "penalty",
                              "cancellation"
                            ]
                          },
                          "service_category": {
                            "type": "string",
                            "description": "Service type code: `fly`, `flyBack`, `hotel`, `railway`, `bus`, `transfer`, `additional`, `refund`, `penalty`, `insurance`, `visa`, ...",
                            "example": "hotel"
                          },
                          "service_class": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Cabin / car class or room type."
                          },
                          "amount": {
                            "type": "string",
                            "description": "The traveller's share of the client price, as a string with a comma decimal separator and no thousands separator. A service with several travellers is split evenly; the rounding remainder goes to the last traveller.",
                            "example": "261,00"
                          },
                          "status": {
                            "type": "string",
                            "description": "Service status: `new`, `preBook`, `booking`, `prePayment`, `finish`, `canceled`, `awaitingCancellation`, `refund`, `canceled_with_fee`, `refused`.",
                            "example": "finish"
                          },
                          "booked_by_email": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "E-mail of the user who placed the order."
                          },
                          "carrier_name": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Airline(s), rail carrier or supplier name."
                          },
                          "booking_reference": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "This traveller's ticket number, otherwise the PNR / supplier booking number."
                          },
                          "act_number": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Act (closing document) number where one is issued; otherwise `null`."
                          },
                          "act_date": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Act date: last day of the order's creation month, `DD.MM.YYYY HH:MM`."
                          },
                          "client_legal_entity": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Legal name of the company that placed the order."
                          },
                          "cost_center": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Cost center name of the order."
                          },
                          "cost_center_code": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Cost center code."
                          },
                          "client_account_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Value of the traveller's custom field named `Master ID`, when the company has one."
                          },
                          "advance_purchase_days": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "description": "Days between the order and the service date."
                          },
                          "last_modified_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Last change of the service, `DD.MM.YYYY HH:MM`, in `timezone` when given."
                          },
                          "custom_fields": {
                            "type": "object",
                            "description": "Every traveller custom field of the company: field name to value (`null` when empty).",
                            "additionalProperties": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "items"
                  ]
                },
                "example": {
                  "items": [
                    {
                      "operation_id": "845123-99812",
                      "trip_id": "TC-61194",
                      "trip_created_at": "02.11.2026 14:05",
                      "route_description": "Berlin - Munich",
                      "origin_location": "Berlin",
                      "destination_location": "Munich",
                      "departure_datetime": "10.11.2026 07:00",
                      "arrival_datetime": "10.11.2026 08:05",
                      "employee_code": null,
                      "employee_name": "Doe John",
                      "travel_document_id": "C01X00T47",
                      "operation_type": "booking",
                      "service_category": "fly",
                      "service_class": "Economy",
                      "amount": "261,00",
                      "status": "finish",
                      "booked_by_email": "travel@example.com",
                      "carrier_name": "Lufthansa",
                      "booking_reference": "2201234567890",
                      "act_number": null,
                      "act_date": "30.11.2026 00:00",
                      "client_legal_entity": "Example GmbH",
                      "cost_center": "Sales",
                      "cost_center_code": "S-01",
                      "client_account_id": null,
                      "advance_purchase_days": 8,
                      "last_modified_at": "02.11.2026 14:07",
                      "custom_fields": {
                        "Project": "Alpha"
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "`timezone` is not a valid IANA time zone."
          },
          "401": {
            "description": "Code `13`: no token. Code `14`: invalid token, or not an API token."
          },
          "403": {
            "description": "Code `130`: the company's Analytics module is off."
          }
        }
      }
    },
    "/v1/statement/filters": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Options for the statement and tax report",
        "description": "What the caller may pick for `GET /v1/statement/export` and `GET /v1/tax-report/export`: the legal entities, whether the statement covers only their own orders, the formats and the longest period.\n\n**Who may download.** Director, travel manager, accountant and TMC admin get the whole company: every order of its legal entities plus the Travel Code cash (deposit) movements. Top manager, employee and traveller get a statement of the orders they placed themselves, without the deposit. Other roles: `403` (code `6`).",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": []
          }
        ],
        "parameters": [
          {
            "name": "companyUserId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "TMC admin only: the client account whose legal entities to list."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "picksCompany": {
                      "type": "boolean",
                      "description": "`true` for a TMC admin, who must pass `companyUserId`."
                    },
                    "company": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "description": "The picked company (TMC admin only).",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "name": {
                          "type": "string"
                        }
                      }
                    },
                    "ownOrdersOnly": {
                      "type": "boolean",
                      "description": "`true`: the statement covers only the caller's own orders, without the deposit."
                    },
                    "agencies": {
                      "type": "array",
                      "description": "Legal entities the caller may pick (empty when `ownOrdersOnly`).",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "integer"
                          },
                          "name": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "currentAgencyId": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "formats": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "example": [
                        "xlsx",
                        "csv",
                        "pdf"
                      ]
                    },
                    "defaultFrom": {
                      "type": "string",
                      "format": "date",
                      "description": "First day of the current month."
                    },
                    "defaultTo": {
                      "type": "string",
                      "format": "date",
                      "description": "Today."
                    },
                    "maxDays": {
                      "type": "integer",
                      "example": 1100
                    }
                  }
                },
                "example": {
                  "picksCompany": false,
                  "company": null,
                  "ownOrdersOnly": false,
                  "agencies": [
                    {
                      "id": 236,
                      "name": "Example GmbH"
                    }
                  ],
                  "currentAgencyId": 236,
                  "formats": [
                    "xlsx",
                    "csv",
                    "pdf"
                  ],
                  "defaultFrom": "2026-12-01",
                  "defaultTo": "2026-12-04",
                  "maxDays": 1100
                }
              }
            }
          },
          "401": {
            "description": "Code `13` / `14`: missing or invalid token (JWT or OAuth only)."
          },
          "403": {
            "description": "Code `6`: the caller's role has no statement."
          }
        }
      }
    },
    "/v1/statement/export": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Download the statement of account",
        "description": "The company's money statement for a period as a file: every movement of money (deposit top-ups and debits, card / bank / cash payments, refunds) and the services it paid for.\n\n**Who may download.** Director, travel manager, accountant and TMC admin get the whole company: every order of its legal entities plus the Travel Code cash (deposit) movements. Top manager, employee and traveller get a statement of the orders they placed themselves, without the deposit. Other roles: `403` (code `6`).\n\n**Formats.**\n- `xlsx`: sheets *Summary* (totals per company and currency), *Money movement* and *Services* (order, travellers, route, dates, supplier, PNR, ticket numbers, amount, supplier taxes and our VAT in the amount, refunded, order total / paid / still to pay).\n- `csv`: the money movement only (UTF-8 with BOM; `,` separator for English, `;` with a decimal comma otherwise).\n- `pdf`: summary and money movement.\n\nHeaders and labels follow the user's language; dates follow the user's date format. File name `statement-<company>-<from>-<to>.<format>` (`Content-Disposition: attachment`).",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": []
          }
        ],
        "parameters": [
          {
            "name": "format",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "xlsx",
                "csv",
                "pdf"
              ]
            },
            "description": "File format.",
            "example": "xlsx"
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "First day, `YYYY-MM-DD`.",
            "example": "2026-11-01"
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Last day, `YYYY-MM-DD`, inclusive. At most 1100 days after `from`.",
            "example": "2026-11-30"
          },
          {
            "name": "agencyId[]",
            "in": "query",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "integer"
              }
            },
            "description": "Only these legal entities (ids from `GET /v1/statement/filters` -> `agencies`). Omit for every entity in reach. An id outside that list answers `403` (code `6`)."
          },
          {
            "name": "companyUserId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "TMC admin only, and required for one: an account of the client company to report on. Ignored for company users."
          }
        ],
        "responses": {
          "200": {
            "description": "The file.",
            "content": {
              "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "text/csv": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Code `20`, the field in `details`: `format` missing or unknown; `from` for a missing, malformed or reversed period or one longer than 1100 days; `companyUserId` when a TMC admin picked no company in reach."
          },
          "401": {
            "description": "Code `13` / `14`: missing or invalid token (JWT or OAuth only)."
          },
          "403": {
            "description": "Code `6`: the role has no statement, or an `agencyId` is outside the caller's legal entities."
          }
        }
      }
    },
    "/v1/tax-report/export": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Download the tax report",
        "description": "What part of what the company paid in a period was tax, as an `xlsx` file. Built on the statement of the same period: same roles, legal entities and orders as `GET /v1/statement/export`.\n\n**Who may download.** Director, travel manager, accountant and TMC admin get the whole company: every order of its legal entities plus the Travel Code cash (deposit) movements. Top manager, employee and traveller get a statement of the orders they placed themselves, without the deposit. Other roles: `403` (code `6`).\n\n**Sheets.** *Summary* (totals by company, currency and month), *Services* (order, travellers, service, supplier, PNR, ticket numbers, issue date, amount, supplier taxes and our VAT in the amount, taxes total, amount excluding taxes, source of the tax figure) and *Tax lines* (each tax by code: amount, currency, in the price or paid on site, passenger, ticket, captured at booking or at ticketing).\n\nTaxes appear only where the supplier or our invoice states them; a service without a tax figure is priced \"including taxes\", not tax-free. File name `tax-report-<company>-<from>-<to>.xlsx`.",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": []
          }
        ],
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "First day, `YYYY-MM-DD`.",
            "example": "2026-11-01"
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Last day, `YYYY-MM-DD`, inclusive. At most 1100 days after `from`.",
            "example": "2026-11-30"
          },
          {
            "name": "agencyId[]",
            "in": "query",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "integer"
              }
            },
            "description": "Only these legal entities (ids from `GET /v1/statement/filters` -> `agencies`). Omit for every entity in reach. An id outside that list answers `403` (code `6`)."
          },
          {
            "name": "companyUserId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "TMC admin only, and required for one: an account of the client company to report on. Ignored for company users."
          }
        ],
        "responses": {
          "200": {
            "description": "The file.",
            "content": {
              "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Code `20`, the field in `details`: `from` for a missing, malformed or reversed period or one longer than 1100 days; `companyUserId` when a TMC admin picked no company in reach."
          },
          "401": {
            "description": "Code `13` / `14`: missing or invalid token (JWT or OAuth only)."
          },
          "403": {
            "description": "Code `6`: the role has no statement, or an `agencyId` is outside the caller's legal entities."
          }
        }
      }
    },
    "/v1/data/transport-stations": {
      "get": {
        "tags": [
          "Data Lookups"
        ],
        "summary": "Stations for a transport search",
        "description": "Station picker for train, bus, ferry and tram searches. Send the returned `id` as `locationFrom` / `locationTo` of `POST /v1/search/trains|buses|ferries|trams`; the search resolves it to each supplier's own code. A station code instead of the id is refused with `404` code `12`.",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": []
          }
        ],
        "parameters": [
          {
            "name": "transportType",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "train",
                "bus",
                "ferry",
                "tram"
              ]
            },
            "description": "Case-insensitive."
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Part of the station or city name."
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "integer",
                            "description": "Send as `locationFrom` / `locationTo`."
                          },
                          "name": {
                            "type": "string"
                          },
                          "country": {
                            "type": "string"
                          },
                          "countryCode": {
                            "type": "string"
                          },
                          "region": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "isStation": {
                            "type": "boolean",
                            "description": "`false` for a city grouping its stations."
                          },
                          "hideChild": {
                            "type": "boolean"
                          }
                        }
                      }
                    },
                    "more": {
                      "type": "boolean",
                      "description": "`true` when the page is full: ask for the next `offset`."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`transportType` missing or not one of the four."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        }
      }
    }
  },
  "webhooks": {
    "commissionProgramPublished": {
      "post": {
        "tags": [
          "Airline Commissions"
        ],
        "summary": "Program published",
        "description": "A new program or a new version of one was approved and is now in force.",
        "operationId": "webhookCommissionProgramPublished",
        "parameters": [
          {
            "name": "X-Travel-Code-Event",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "const": "commission.program.published"
            }
          },
          {
            "name": "X-Travel-Code-Delivery",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Travel-Code-Signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "example": "t=1791436633,v1=5f0c…"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "id",
                  "event",
                  "createdAt",
                  "data"
                ],
                "properties": {
                  "id": {
                    "type": "string",
                    "example": "evt_f8e35bc8a8197b35e8f1085f",
                    "description": "Event id, unique per event"
                  },
                  "event": {
                    "type": "string",
                    "const": "commission.program.published"
                  },
                  "createdAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "data": {
                    "type": "object",
                    "required": [
                      "schemaVersion",
                      "source",
                      "status",
                      "programs"
                    ],
                    "properties": {
                      "schemaVersion": {
                        "type": "string",
                        "const": "1.0"
                      },
                      "source": {
                        "$ref": "#/components/schemas/CommissionSource"
                      },
                      "status": {
                        "type": "string",
                        "const": "active"
                      },
                      "replacesVersion": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "description": "Version of the document this one replaces, null for a new program"
                      },
                      "programs": {
                        "type": "array",
                        "items": {
                          "$ref": "#/components/schemas/CommissionProgram"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Anything else is retried."
          }
        }
      }
    },
    "commissionProgramRetired": {
      "post": {
        "tags": [
          "Airline Commissions"
        ],
        "summary": "Program replaced",
        "description": "A newer version of the document was approved; these programs are no longer in force.",
        "operationId": "webhookCommissionProgramRetired",
        "parameters": [
          {
            "name": "X-Travel-Code-Event",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "const": "commission.program.retired"
            }
          },
          {
            "name": "X-Travel-Code-Delivery",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Travel-Code-Signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "example": "t=1791436633,v1=5f0c…"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "id",
                  "event",
                  "createdAt",
                  "data"
                ],
                "properties": {
                  "id": {
                    "type": "string",
                    "example": "evt_f8e35bc8a8197b35e8f1085f",
                    "description": "Event id, unique per event"
                  },
                  "event": {
                    "type": "string",
                    "const": "commission.program.retired"
                  },
                  "createdAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "data": {
                    "type": "object",
                    "required": [
                      "source",
                      "programCodes",
                      "airlines",
                      "replacedBy"
                    ],
                    "properties": {
                      "source": {
                        "$ref": "#/components/schemas/CommissionSource"
                      },
                      "programCodes": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "airlines": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        },
                        "description": "IATA codes"
                      },
                      "replacedBy": {
                        "type": "object",
                        "properties": {
                          "document": {
                            "type": "string"
                          },
                          "documentVersion": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Anything else is retried."
          }
        }
      }
    },
    "commissionProgramExpiring": {
      "post": {
        "tags": [
          "Airline Commissions"
        ],
        "summary": "Program expiring",
        "description": "Sent once, 14 days before the last travel date of a program.",
        "operationId": "webhookCommissionProgramExpiring",
        "parameters": [
          {
            "name": "X-Travel-Code-Event",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "const": "commission.program.expiring"
            }
          },
          {
            "name": "X-Travel-Code-Delivery",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Travel-Code-Signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "example": "t=1791436633,v1=5f0c…"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "id",
                  "event",
                  "createdAt",
                  "data"
                ],
                "properties": {
                  "id": {
                    "type": "string",
                    "example": "evt_f8e35bc8a8197b35e8f1085f",
                    "description": "Event id, unique per event"
                  },
                  "event": {
                    "type": "string",
                    "const": "commission.program.expiring"
                  },
                  "createdAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "data": {
                    "type": "object",
                    "required": [
                      "programCode",
                      "airlines",
                      "validTo"
                    ],
                    "properties": {
                      "programCode": {
                        "type": "string"
                      },
                      "airlines": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        },
                        "description": "IATA codes"
                      },
                      "validTo": {
                        "type": "string",
                        "format": "date",
                        "description": "Last travel date"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Anything else is retried."
          }
        }
      }
    },
    "commissionProgramExpired": {
      "post": {
        "tags": [
          "Airline Commissions"
        ],
        "summary": "Program expired",
        "description": "Sent once, the day after the last travel date of a program.",
        "operationId": "webhookCommissionProgramExpired",
        "parameters": [
          {
            "name": "X-Travel-Code-Event",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "const": "commission.program.expired"
            }
          },
          {
            "name": "X-Travel-Code-Delivery",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Travel-Code-Signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "example": "t=1791436633,v1=5f0c…"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "id",
                  "event",
                  "createdAt",
                  "data"
                ],
                "properties": {
                  "id": {
                    "type": "string",
                    "example": "evt_f8e35bc8a8197b35e8f1085f",
                    "description": "Event id, unique per event"
                  },
                  "event": {
                    "type": "string",
                    "const": "commission.program.expired"
                  },
                  "createdAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "data": {
                    "type": "object",
                    "required": [
                      "programCode",
                      "airlines",
                      "validTo"
                    ],
                    "properties": {
                      "programCode": {
                        "type": "string"
                      },
                      "airlines": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        },
                        "description": "IATA codes"
                      },
                      "validTo": {
                        "type": "string",
                        "format": "date",
                        "description": "Last travel date, already past"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Anything else is retried."
          }
        }
      }
    }
  }
}