Python SDK (Beta)
Python SDK (Beta)
The Python SDK is in beta. It exposes the Collate Prior Auth API as typed Python methods for server-side integrations, background workers, and internal tools that create and monitor authorizations.
The REST API remains the canonical integration surface while the SDK is in beta. Use the Python SDK from backend services, workers, and internal tools. Do not expose API keys in client-side applications.
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 in the environment, then create a client.
Pass the key directly only when environment variables are not available:
Create an Authorization
Create exactly one authorization for one payer submission. Use a fresh idempotency key for each new create request, and reuse the same key only when retrying the exact same body.
Resolve Requirements
When status = "requires_action" and
next_action.type = "resolve_requirements", patch answers or attach files.
Use the current authorization version in If-Match.
Answer and attachment writes recompute requirements. They do not resume
Collate processing by themselves. Call /confirm only when the updated
authorization exposes continue_authorization or approve_submission.
Attach a File
The SDK creates and completes the file resource. Upload bytes directly to the single-use URL returned by the API.
Confirm the Current Action
Confirm only confirmable actions.
After confirmation, Collate usually owns the next step and the authorization
returns to processing.
Poll for Changes
Async Usage
Use AsyncCollate inside asyncio applications.
Error Handling
The SDK raises ApiError for non-2xx API responses.
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.
Method Map
See the API reference for exact request and response fields.