TypeScript SDK
Request Options
Cancel requests and add metadata headers to SDK calls.
Every SDK method accepts an optional RequiplyRequestOptions object as its final argument:
interface RequiplyRequestOptions {
signal?: AbortSignal;
headers?: HeadersInit;
}
const abortController = new AbortController();
await requiply.pricing.quote(
{
startDate: '2026-07-01T10:00:00',
endDate: '2026-07-03T18:00:00',
items: [{ groupId: cameraKitId, quantity: 1 }],
},
{
signal: abortController.signal,
headers: {
'X-Request-Source': 'nightly-sync',
},
},
);
Client-wide headers
Set headers for every request when constructing the client:
const requiply = new RequiplyClient({
apiKey: process.env.REQUIPLY_SECRET_KEY!,
headers: { 'X-Integration-Name': 'example-backend' },
});
Method headers override client-wide headers with the same name. The SDK always sets Accept, Authorization, and, for request bodies, Content-Type after merging custom headers.
Browsers block cross-origin requests with headers the API does not allow. Add custom headers from server code only.
Retries
The API does not deduplicate requests, and version 0.2.0 removed the idempotencyKey option that earlier versions sent without effect. Reads and quotes are safe to retry. Before retrying bookings.create() or sales.create() after a timeout or a network error, check whether the first attempt went through, for example with bookings.list({ createdFrom }) or sales.list({ soldFrom }), or you may create a second booking or sale.