Cosmos API
    • Overview
    • Getting started
    • Authentication
    • Environments
    • Rate Limits & Quotas
    • Error Handling
    • Idempotency & State management
    • Forward Compatibility
    • Upsert flight legs
      POST
    • Schemas
      • IngestRequest
      • FlightLeg
      • Delay
      • PassengersPerCabinClass
      • SpecialServices
      • TurnaroundFeedbackCheck
      • IngestResponse
      • MishandledBag
      • IngestResult
      • IngestSummary
      • ValidationError
      • ErrorResponse
    Open appWebsiteStatusLinkedin
    Open appWebsiteStatusLinkedin

      Upsert flight legs

      POST
      /webhooks/ingest/flight_legs
      Last modified:2026-03-30 10:39:14
      Upserts up to 50 flight legs in a single request. Each leg is processed
      independently — failures on individual records do not roll back others.
      Always send the complete current state of each flight leg.

      Request

      Authorization
      API Key
      Add parameter in header
      X-Ingest-Webhook-Secret
      Example:
      X-Ingest-Webhook-Secret: ********************
      or
      Body Params application/jsonRequired

      Examples

      Responses

      🟢200
      application/json
      All records succeeded
      Bodyapplication/json

      🟢207
      🟠401
      🟠422
      🟠429
      Request Request Example
      Shell
      JavaScript
      Java
      Swift
      cURL
      curl --location 'https://api.usecosmos.cloud/webhooks/ingest/flight_legs' \
      --header 'X-Ingest-Webhook-Secret: <api-key>' \
      --header 'Content-Type: application/json' \
      --data '{
          "flight_legs": [
              {
                  "external_id": "test-001",
                  "airline": "AB",
                  "flight_number": "6210",
                  "origin": "MUC",
                  "destination": "TXL",
                  "scheduled_departure_at": "2026-03-24T08:30:00Z",
                  "delays": [],
                  "passengers_per_cabin_class": {},
                  "special_services": {}
              }
          ]
      }'
      Response Response Example
      200 - Success
      {
          "results": [
              {
                  "external_id": "test-001",
                  "status": "success",
                  "flight_leg_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
              }
          ],
          "summary": {
              "total": 1,
              "succeeded": 1,
              "failed": 0
          }
      }
      Previous
      Forward Compatibility
      Next
      IngestRequest
      Built with