Integrate document extraction and review workflows into your applications.
All API requests require an API key passed in the X-API-Key header. Generate keys from the API settings page in your dashboard.
curl https://api.casmoai.com/v1/extract \ -H "X-API-Key: cai_your_api_key_here" \ -F "file=@document.pdf" \ -F "mode=response"
https://api.casmoai.com
Both endpoints support two modes via the mode form field:
Waits for processing to complete and returns the result in the HTTP response body. Webhooks are still fired if configured.
Returns immediately with a job ID. The result is delivered asynchronously via your registered webhooks.
Configure webhooks in the API settings page to receive event notifications. Webhooks are fired whenever a matching event occurs, regardless of the request mode.
| Event | Description |
|---|---|
extraction.completed | Fired when document extraction finishes (success or failure) |
review.completed | Fired when a review against a workflow finishes |
{
"event": "extraction.completed",
"timestamp": "2024-01-15T10:30:00.000Z",
"data": {
"job_id": "temp_1_1234567890",
"filename": "invoice.pdf",
"result": { ... }
}
}Each webhook request includes an X-Webhook-Signature header containing an HMAC-SHA256 hex digest of the request body, signed with your webhook secret.
import hmac
import hashlib
def verify_signature(body: bytes, signature: str, secret: str) -> bool:
expected = hmac.new(
secret.encode(), body, hashlib.sha256
).hexdigest()
return hmac.compare_digest(expected, signature)| Status | Description |
|---|---|
400 | Bad request — invalid file type, missing parameters, or invalid mode |
401 | Unauthorized — missing or invalid API key |
404 | Not found — workflow does not exist or does not belong to you |
500 | Server error — document parsing or processing failed |
504 | Timeout — document processing took too long |