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

    Error Handling

    Cosmos uses standard HTTP status codes and returns structured error information to help you diagnose and resolve issues programmatically.

    HTTP Status Codes#

    CodeMeaningAction
    200All flight legs processed successfullyNo action needed
    207Partial success — some legs succeeded, some failedCheck results array for per-leg status
    401Authentication failedVerify your API key
    422Batch size exceeds limit (max 50)Reduce number of flight legs
    429Rate limit exceeded (60 req/min)Wait for Retry-After header, then retry

    Partial success (207)#

    WARNING
    This is the most important status to handle correctly.
    A 207 response means the request was valid, but one or more individual flight legs failed validation. The response body contains a results array where each entry has a status of either "success" or "failed".
    For failed entries, the errors array contains ValidationError objects with a dot-notation field path (e.g., delays[0].code) and a human-readable message.

    Common validation errors#

    Invalid IATA codes
    Missing required fields
    Values outside allowed ranges
    Batch size exceeded

    Error response structure#

    All error responses (401, 422, 429) return the same structure:
    {
      "errors": [
        {
          "code": "not_authorized | request_size_exceeded | rate_limit_exceeded",
          "detail": null,
          "source": null
        }
      ]
    }

    Retry strategy#

    StatusAction
    401Do not retry — fix credentials. Error code: not_authorized
    422Do not retry — reduce batch size. Error code: request_size_exceeded
    429Wait for Retry-After header value, then retry. Error code: rate_limit_exceeded
    207Retry only the failed legs after fixing validation issues
    5xxRetry with exponential backoff (start at 1s, max 60s)

    Troubleshooting#

    My request returns 422 but the payload looks correct
    Some records succeed but others fail (207)
    I'm hitting the rate limit (429)
    My delays aren't showing up / are being removed unexpectedly
    Fields are being cleared that I didn't change
    I sent a diversion but Cosmos created a new record instead of updating
    Previous
    Rate Limits & Quotas
    Next
    Idempotency & State management
    Built with