API reference
Authentication
The Composa API's base URL, how to send an API key, and what each kind of key can reach.
Base URL
Every call goes to one address:
/v1 is the version of the API. Addresses the API hands back, like a batch's status_url, are on the same base.
API keys
Send your key as a bearer token on every call:
bash
curl "https://api.composa.ai/v1/contract?template_id=85416813-8d99-46e8-be2b-1d61cee5db38" \ -H "Authorization: Bearer $COMPOSA_API_KEY"Keys belong to the Team, not to a person. An Admin makes them on the API keys page of the app, with a name and one of two permissions:
| Permission | Reaches |
|---|---|
| Full access | Every template of the Team, including ones made later. |
| Template access | Only the templates on its list. A template made later is on no list until an Admin adds it. |
With a template it reaches, either kind of key does the same things: print one document, start, read and cancel a batch, and read the template's fields.
- A key starts with
cmp_live_and is shown once. Composa stores only a hash, so a lost key cannot be recovered: make a new one. - An Admin can change a key's list or permission later. The key's value stays the same.
- A revoked key answers
401from its next call. - Keys are for servers. Never put one in a browser or a mobile app.
The MCP server does not take API keys: agents sign in through the browser.
Authentication errors
| Status | Code | Meaning |
|---|---|---|
401 | The key is missing, malformed or revoked. | |
403 | template_not_allowed | The key has Template access and this template is not on its list. The same answer is given whether the template exists or not. |
404 | The template does not exist in your Team. |
Compression
Send Accept-Encoding: gzip (with curl, --compressed). JSON answers come back smaller at no cost.