Defaults
| Setting | Default |
|---|---|
| Base URL | https://api.voyant.travel |
| Auth header | authorization |
| Auth scheme | Bearer |
| SDK marker | x-voyant-sdk: voyant-sdk |
Client options
Every client accepts transport-level options:apiKeyfor the bearer token.baseUrlto point at a different environment.authHeaderandauthSchemeto change how the token is sent.headersfor extra default headers.fetchto inject a custom fetch implementation.userAgentto set your own user-agent marker.
Request behavior
- Query params that are
nullorundefinedare skipped. - Arrays are serialized as repeated query params.
- Non-
BodyInitobjects are JSON-encoded automatically. content-type: application/jsonis set for JSON request bodies.
Response behavior
- JSON responses are parsed automatically.
- Plain text that looks like JSON is parsed defensively.
{ data: ... }envelopes are unwrapped by default. Opt out withunwrapData: false.
{ data, totalCount, nextCursor? } envelope on list endpoints and { data } on single-item endpoints, so you keep pagination metadata. See Voyant Data.
Errors
Any non-2xx response throwsVoyantApiError, which carries:
status, the HTTP status code.requestId, the server-assigned request id.body, the parsed error body.
requestId in logs and support requests. It is how Voyant traces a specific call.
Data API error codes
The Data API additionally returns a stablecode on its error bodies, typed as DataErrorCode:
NOT_FOUND, INVALID_REQUEST, INVALID_CURSOR, UPSTREAM_FAILED, INTERNAL_AUTH_REQUIRED, RATE_LIMITED.
Branch on code rather than parsing error messages.
Idempotency
Where a write can be safely retried, the SDK exposes an idempotency key. Connect’sbookings.create accepts { idempotencyKey }, sent as the Idempotency-Key header and deduplicated server-side. Pass a stable key per logical attempt so retries do not create duplicates. See Connect SDK.