Skip to Content

Conventions

Versions, request and response shapes, formats, paging and identifiers, shared by both APIs.

Both APIs follow the same rules, so code you write for one carries over to the other.

Versions

The version is in the path: https://api.voyagelabs.ai/v1/....

  • Within v1, fields are only ever added. Your code must ignore fields it doesn't know.
  • A field or endpoint is never removed, or changed in meaning, within v1. A change like that means v2. v1 keeps running beside it, and its answers carry a Sunset header once an end date is set.
  • New error codes can be added within v1. Handle unknown codes by their retry advice.

Requests

  • Send the key in the X-API-Key header. See Keys and authentication.
  • Search endpoints take either query parameters (GET) or a JSON body (POST) with Content-Type: application/json. A body may be up to 16 KB.
  • Everything is UTF-8.

Responses

Every JSON answer is one of two shapes. A response has data or error, never both.

Success
{
  "data": { },
  "meta": { "request_id": "req_41ab9c", "mode": "live" }
}
Failure
{
  "error": {
    "code": "search_not_found",
    "message": "No search with that id. Searches are kept for at least 30 minutes; run the search again.",
    "retry": "never",
    "request_id": "req_41ab9c"
  }
}
  • meta.request_id names the request, and is also in the X-Request-Id header.
  • meta.mode is live or test, after the key that made the call.
  • Finding nothing is a success, with an empty list.
  • Errors lists every code.

Formats

KindFormatExample
DatesYYYY-MM-DD2027-02-09
MomentsISO 8601 in UTC, ending Z2026-12-02T00:20:11Z
Flight timesLocal time at the airport, with no offset. A _utc twin gives the same moment in UTC."depart": "2027-02-09T10:45:00", "depart_utc": "2027-02-09T18:45:00Z"
MoneyA number in the currency's main unit, beside a 3-letter currency code"total": 2823.38, "currency": "USD"
DurationsWhole units, named in the fieldduration_min, age_s, retry_after_s
Airports3-letter IATA codesSFO
Airlines2-character codesNH
Countries2-letter ISO codesUS

Identifiers

Ids such as search_id, result ids and request_id are opaque strings. Store them and pass them back as they are. Never parse them, build them or rely on their length.

Paging

Lists come one page at a time:

  1. Ask for a page size with limit.
  2. If the answer's next_cursor is not null, pass it back as cursor to get the next page.
  3. When next_cursor is null, you have the whole list.

Page a search once it has finished. While a search is still running, the list can change between pages.

Prices have an age

Every search answer says when its prices were found, in pricing.priced_at, and how many seconds ago that was, in pricing.age_s. Prices go stale as rooms and seats sell. Search again before you show a price once age_s is over 240 for flights, or over 900 for hotels.

Browsers and CORS

The APIs answer requests from any web origin. Calls with a live key still belong on your server, because a key in a web page is public. See Keep live keys on your server.

On this page