TypeScript SDK (Beta)
TypeScript SDK (Beta)
The TypeScript SDK is in beta. It exposes the Collate Prior Auth API as typed methods for Node.js. Use it in backend services, workers, route handlers, and server actions. Do not import it into browser code, because that would expose your API key.
The REST API remains the canonical integration surface while the SDK is in beta. Use the TypeScript SDK in backend services, workers, route handlers, and server actions. Do not import it into browser code.
Install
If your organization does not have SDK beta access, use the REST API guides and API reference instead.
Configure the Client
Set your API key and create a client.
Create an Authorization
Create exactly one authorization for one payer submission. Use a fresh idempotency key for each new create request.
Resolve Requirements
When the authorization asks for requirements, patch answers or attach files.
Send the current version as If-Match.
The response is the updated authorization. If requirements cleared, the next
action usually changes to continue_authorization or approve_submission.
Attach a File
The API returns a single-use upload target. Upload the bytes to that URL, then complete and attach the file.
Confirm the Current Action
Confirm only when nextAction.type is continue_authorization or
approve_submission.
After confirmation, poll the authorization until it needs another action, waits on the payer, completes, or cancels.
Error Handling
The SDK throws CollateError for API errors.
Use error.body.error.code for recovery logic when the body is the standard
Collate error envelope. Common recoverable codes are version_conflict,
review_stale, requirements_not_satisfied, and live_session_not_available.
Framework Usage
Use the SDK only on the server.
Method Map
See the API reference for exact request and response fields.