Two layers
- Authentication — who is calling (API key, shared secret, JWT)
- Access policy — what the caller can do on a specific document
Authentication
Every request is authenticated via one of:| Method | Header | Use case |
|---|---|---|
| API key | Authorization: Bearer okra_sk_... | Server-to-server |
| Publishable key | Authorization: Bearer okra_pk_... | Browser clients |
| Shared secret | x-document-agent-secret: ... | Internal worker-to-worker |
public grant in their access policy.
Access policy
Each document has a deny-by-default access policy with explicit grants. A grant maps a principal (who) to actions (what).Route classes
Public read surface (/v1/documents/...)
Published outputs, CDN-cacheable. Access controlled by document grants.
GET /v1/documents/{id}— metadataGET /v1/documents/{id}/pages/{n}— page contentPOST /v1/public/resolve/chat/completions— public source chat
Private authenticated surface (/document/...)
Mutations and configuration. Requires API key or shared secret.
PUT /document/{id}/config— set access policyPOST /document/{id}/reparse— re-processPOST /document/{id}/extract— trigger extraction
Caching
- Public routes:
Cache-Control: public(CDN-safe) - Private routes:
Cache-Control: privateorno-store