Workspace
Settings, API keys, audit log, analytics and usage.
curl -X GET "https://docuflow.pendral.io/api/v2/settings" \-H "Authorization: Bearer $DOCUFLOW_API_KEY"
{"settings": {"id": "clx9k2m4p0001qh8z3v7d5f2a","name": "Invoices","slug": "invoices","logo": "logo","createdAt": "2026-10-01T12:00:00.000Z","retentionDays": 1,"defaultThreshold": 1,"allowedDomains": ["allowedDomain"],"defaultModel": "defaultModel","counts": {"members": 1,"documents": 1,"queues": 1}},"role": "role"}
Update workspace settings#
Update workspace settings
/api/v2/settingsRequires settings:manage.
Body
application/jsonnamestringslugstringlogostring | nullretentionDaysinteger | nulldefaultThresholdnumberallowedDomainsstring[]defaultModelstring | null
Responses
OK
curl -X PATCH "https://docuflow.pendral.io/api/v2/settings" \-H "Authorization: Bearer $DOCUFLOW_API_KEY" \-H "Content-Type: application/json" \-d '{"name": "Invoices","slug": "invoices"}'
{"settings": {"id": "clx9k2m4p0001qh8z3v7d5f2a","name": "Invoices","slug": "invoices","logo": "logo","createdAt": "2026-10-01T12:00:00.000Z","retentionDays": 1,"defaultThreshold": 1,"allowedDomains": ["allowedDomain"],"defaultModel": "defaultModel","counts": {"members": 1,"documents": 1,"queues": 1}}}
List business calendars#
Weekly open intervals, holiday presets and date exceptions SLA clocks count in, with the queues using each. The workspace default is created on first read.
/api/v2/business-calendarsRequires queues:read.
Responses
OK
curl -X GET "https://docuflow.pendral.io/api/v2/business-calendars" \-H "Authorization: Bearer $DOCUFLOW_API_KEY"
{"calendars": [{"name": "Invoices","timeZone": "timeZone","week": [[{"start": 1,"end": 1}]],"presets": ["us_federal"],"exceptions": [{"date": "date","name": "Invoices","hours": []}],"id": "clx9k2m4p0001qh8z3v7d5f2a","isDefault": false,"updatedAt": "2026-10-01T12:00:00.000Z","queues": [{"id": "clx9k2m4p0001qh8z3v7d5f2a","name": "Invoices"}]}]}
Create a business calendar#
Create a business calendar
/api/v2/business-calendarsRequires settings:manage.
Body
application/jsonnamestringrequiredtimeZonestringrequiredweekobject[][]requiredpresets("us_federal" | "payer_common")[]requiredexceptionsobject[]required
Responses
OK
curl -X POST "https://docuflow.pendral.io/api/v2/business-calendars" \-H "Authorization: Bearer $DOCUFLOW_API_KEY" \-H "Content-Type: application/json" \-d '{"name": "Invoices","timeZone": "timeZone","week": [[{"start": 1,"end": 1}]],"presets": ["us_federal"],"exceptions": [{"date": "date","name": "Invoices","hours": [{"start": 1,"end": 1}]}]}'
{"calendar": {"name": "Invoices","timeZone": "timeZone","week": [[{"start": 1,"end": 1}]],"presets": ["us_federal"],"exceptions": [{"date": "date","name": "Invoices","hours": [{"start": 1,"end": 1}]}],"id": "clx9k2m4p0001qh8z3v7d5f2a","isDefault": false,"updatedAt": "2026-10-01T12:00:00.000Z"}}
Get a business calendar#
One calendar with the queues whose business-hours SLA counts in it.
/api/v2/business-calendars/{id}Requires queues:read.
Path parameters
idstringrequired- Calendar id.
Responses
OK
curl -X GET "https://docuflow.pendral.io/api/v2/business-calendars/{id}" \-H "Authorization: Bearer $DOCUFLOW_API_KEY"
{"calendar": {"name": "Invoices","timeZone": "timeZone","week": [[{"start": 1,"end": 1}]],"presets": ["us_federal"],"exceptions": [{"date": "date","name": "Invoices","hours": [{"start": 1,"end": 1}]}],"id": "clx9k2m4p0001qh8z3v7d5f2a","isDefault": false,"updatedAt": "2026-10-01T12:00:00.000Z","queues": [{"id": "clx9k2m4p0001qh8z3v7d5f2a","name": "Invoices"}]}}
Update a business calendar#
Send isDefault: true to make it the workspace default. Open, not-yet-breached documents on affected queues get their due times re-computed.
/api/v2/business-calendars/{id}Requires settings:manage.
Path parameters
idstringrequired- Calendar id.
Body
application/jsonnamestringtimeZonestringweekobject[][]presets("us_federal" | "payer_common")[]exceptionsobject[]isDefaulttrue
Responses
OK
curl -X PATCH "https://docuflow.pendral.io/api/v2/business-calendars/{id}" \-H "Authorization: Bearer $DOCUFLOW_API_KEY" \-H "Content-Type: application/json" \-d '{"name": "Invoices"}'
{"calendar": {"name": "Invoices","timeZone": "timeZone","week": [[{"start": 1,"end": 1}]],"presets": ["us_federal"],"exceptions": [{"date": "date","name": "Invoices","hours": [{"start": 1,"end": 1}]}],"id": "clx9k2m4p0001qh8z3v7d5f2a","isDefault": false,"updatedAt": "2026-10-01T12:00:00.000Z"}}
Delete a business calendar#
The default can't be deleted. Queues on it fall back to the default.
/api/v2/business-calendars/{id}Requires settings:manage.
Path parameters
idstringrequired- Calendar id.
Responses
OK
curl -X DELETE "https://docuflow.pendral.io/api/v2/business-calendars/{id}" \-H "Authorization: Bearer $DOCUFLOW_API_KEY"
{"ok": true}
AI spend#
What the models cost over a period, grouped by day, model, kind of work, queue and document. Computed from the per-call record.
/api/v2/spendRequires usage:read.
Query parameters
period"24h" | "7d" | "30d" | "90d"- Default
"30d"
Responses
OK
curl -X GET "https://docuflow.pendral.io/api/v2/spend" \-H "Authorization: Bearer $DOCUFLOW_API_KEY"
{"period": "period","from": "2026-10-01T12:00:00.000Z","promptsRecorded": false,"totals": {"calls": 1,"errors": 1,"inputTokens": 1,"outputTokens": 1,"cachedTokens": 1,"reasoningTokens": 1,"costUsd": 1,"medianMs": 1,"p95Ms": 1},"byDay": [{"day": "day","costUsd": 1,"calls": 1}],"byModel": [{"key": "invoiceNumber","label": "Invoice number","calls": 1,"costUsd": 1,"inputTokens": 1,"outputTokens": 1,"medianMs": 1}],"byKind": [{"key": "invoiceNumber","label": "Invoice number","calls": 1,"costUsd": 1,"inputTokens": 1,"outputTokens": 1,"medianMs": 1}],"byQueue": [{"key": "invoiceNumber","label": "Invoice number","calls": 1,"costUsd": 1,"inputTokens": 1,"outputTokens": 1,"medianMs": 1}],"topDocuments": [{"documentId": "clx9k2m4p0001qh8z3v7d5f2a","name": "Invoices","costUsd": 1,"calls": 1}]}
List AI traces#
One row per piece of AI work — an extraction, a classification, a rule that asked a model something — with its token counts, cost and duration.
/api/v2/tracesRequires usage:traces.cursor-paginated
Query parameters
period"24h" | "7d" | "30d" | "90d"kindstringstatus"running" | "ok" | "error"documentIdstringqueueIdstringsearchstringcursorstringlimitinteger
Responses
OK. Cursor-paginated: pass nextCursor back as cursor; null means the last page.
curl -X GET "https://docuflow.pendral.io/api/v2/traces" \-H "Authorization: Bearer $DOCUFLOW_API_KEY"
{"items": [{"id": "clx9k2m4p0001qh8z3v7d5f2a","kind": "kind","name": "Invoices","source": "upload","status": "status","error": null,"documentId": "clx9k2m4p0001qh8z3v7d5f2a","queueId": "clx9k2m4p0001qh8z3v7d5f2a","userId": "clx9k2m4p0001qh8z3v7d5f2a","callCount": 1,"errorCount": 1,"inputTokens": 1,"outputTokens": 1,"cachedTokens": 1,"reasoningTokens": 1,"costUsd": 1,"startedAt": "2026-10-01T12:00:00.000Z","endedAt": "2026-10-01T12:00:00.000Z","durationMs": 184}],"nextCursor": "clx9k2m4p0001qh8z3v7d5f2a"}
One AI trace#
The trace with every model call inside it, in the order they were made. Prompt and answer text is only present when prompt capture is enabled for the deployment.
/api/v2/traces/{id}Requires usage:traces.
Path parameters
idstringrequired- Trace id.
Responses
OK
curl -X GET "https://docuflow.pendral.io/api/v2/traces/{id}" \-H "Authorization: Bearer $DOCUFLOW_API_KEY"
{"trace": {"id": "clx9k2m4p0001qh8z3v7d5f2a","kind": "kind","name": "Invoices","source": "upload","status": "status","error": null,"documentId": "clx9k2m4p0001qh8z3v7d5f2a","queueId": "clx9k2m4p0001qh8z3v7d5f2a","userId": "clx9k2m4p0001qh8z3v7d5f2a","callCount": 1,"errorCount": 1,"inputTokens": 1,"outputTokens": 1,"cachedTokens": 1,"reasoningTokens": 1,"costUsd": 1,"startedAt": "2026-10-01T12:00:00.000Z","endedAt": "2026-10-01T12:00:00.000Z","durationMs": 184,"metadata": {},"spans": [{"id": "clx9k2m4p0001qh8z3v7d5f2a","seq": 1,"kind": "kind","name": "Invoices","status": "status","error": null,"model": "model","provider": "provider","finishReason": "finishReason","promptText": "promptText","outputText": "outputText","params": {},"truncated": false,"inputTokens": 1,"outputTokens": 1,"cachedTokens": 1,"reasoningTokens": 1,"costUsd": 1,"startedAt": "2026-10-01T12:00:00.000Z","endedAt": "2026-10-01T12:00:00.000Z","durationMs": 184}],"document": {"id": "clx9k2m4p0001qh8z3v7d5f2a","name": "invoice-1042.pdf","status": "status"},"queue": {"id": "clx9k2m4p0001qh8z3v7d5f2a","name": "Invoices","slug": "invoices","color": "indigo"},"promptsRecorded": false}}
List API keys#
List API keys
/api/v2/api-keysRequires apiKeys:read.
Needs a signed-in person: API keys can't call this.
Responses
OK
curl -X GET "https://docuflow.pendral.io/api/v2/api-keys" \-H "Cookie: __Secure-better-auth.session_token=$DOCUFLOW_SESSION"
{"apiKeys": [{"id": "clx9k2m4p0001qh8z3v7d5f2a","name": "Accounts payable sync","prefix": "dfk_live_7Hq2","scopes": ["documents:read","documents:create"],"rateLimit": 1,"lastUsedAt": "2026-10-01T12:00:00.000Z","expiresAt": null,"revokedAt": null,"createdAt": "2026-10-01T12:00:00.000Z","createdBy": {"id": "clx9k2m4p0001qh8z3v7d5f2a","name": "Ada Lovelace","email": "ada@example.com","image": null}}]}
Create an API key#
The dfk_ token is returned once. scopes are narrowed to the grantable catalog and to your own permissions; governance scopes are never grantable.
/api/v2/api-keysRequires apiKeys:manage.
Needs a signed-in person: API keys can't call this.
Body
application/jsonnamestringrequiredexpiresAtstring | nullscopesstring[]rateLimitinteger | null
Responses
OK
curl -X POST "https://docuflow.pendral.io/api/v2/api-keys" \-H "Cookie: __Secure-better-auth.session_token=$DOCUFLOW_SESSION" \-H "Content-Type: application/json" \-d '{"name": "Invoices","scopes": ["documents:read","documents:create"]}'
{"apiKey": {"id": "clx9k2m4p0001qh8z3v7d5f2a","name": "Accounts payable sync","prefix": "dfk_live_7Hq2","scopes": ["documents:read","documents:create"],"rateLimit": 1,"lastUsedAt": "2026-10-01T12:00:00.000Z","expiresAt": null,"revokedAt": null,"createdAt": "2026-10-01T12:00:00.000Z","createdBy": {"id": "clx9k2m4p0001qh8z3v7d5f2a","name": "Ada Lovelace","email": "ada@example.com","image": null}},"token": "dfk_live_7Hq2xV9mLr4tW8bN3cKp"}
Get an API key#
Its name, prefix, scopes, rate limit, creator and when it was last used. Never the token. Keys can't hold apiKeys:*, so managing keys needs a signed-in person; a key can describe itself through /whoami.
/api/v2/api-keys/{id}Requires apiKeys:read.
Needs a signed-in person: API keys can't call this.
Path parameters
idstringrequired- API key id.
Responses
OK
curl -X GET "https://docuflow.pendral.io/api/v2/api-keys/{id}" \-H "Cookie: __Secure-better-auth.session_token=$DOCUFLOW_SESSION"
{"apiKey": {"id": "clx9k2m4p0001qh8z3v7d5f2a","name": "Accounts payable sync","prefix": "dfk_live_7Hq2","scopes": ["documents:read","documents:create"],"rateLimit": 1,"lastUsedAt": "2026-10-01T12:00:00.000Z","expiresAt": null,"revokedAt": null,"createdAt": "2026-10-01T12:00:00.000Z","createdBy": {"id": "clx9k2m4p0001qh8z3v7d5f2a","name": "Ada Lovelace","email": "ada@example.com","image": null}}}
Change an API key's rate limit#
rateLimit is requests per minute; null puts the key back on the workspace default.
/api/v2/api-keys/{id}Requires apiKeys:manage.
Needs a signed-in person: API keys can't call this.
Path parameters
idstringrequired- API key id.
Body
application/jsonrateLimitinteger | nullrequired
Responses
OK
curl -X PATCH "https://docuflow.pendral.io/api/v2/api-keys/{id}" \-H "Cookie: __Secure-better-auth.session_token=$DOCUFLOW_SESSION" \-H "Content-Type: application/json" \-d '{"rateLimit": 1}'
{"apiKey": {"id": "clx9k2m4p0001qh8z3v7d5f2a","name": "Accounts payable sync","prefix": "dfk_live_7Hq2","scopes": ["documents:read","documents:create"],"rateLimit": 1,"lastUsedAt": "2026-10-01T12:00:00.000Z","expiresAt": null,"revokedAt": null,"createdAt": "2026-10-01T12:00:00.000Z","createdBy": {"id": "clx9k2m4p0001qh8z3v7d5f2a","name": "Ada Lovelace","email": "ada@example.com","image": null}}}
Revoke an API key#
Revoke an API key
/api/v2/api-keys/{id}Requires apiKeys:manage.
Needs a signed-in person: API keys can't call this.
Path parameters
idstringrequired- API key id.
Responses
OK
curl -X DELETE "https://docuflow.pendral.io/api/v2/api-keys/{id}" \-H "Cookie: __Secure-better-auth.session_token=$DOCUFLOW_SESSION"
{"ok": true}
Audit log#
Append-only activity. action matches a prefix when it ends with a dot (document.). format=csv downloads up to 500 rows as CSV.
/api/v2/auditRequires audit:read.cursor-paginated
Query parameters
actorstringactionstringtargetTypestringtargetIdstringsearchstringfromstringtostringcursorstringlimitnumberformat"json" | "csv"
Responses
OK. Cursor-paginated: pass nextCursor back as cursor; null means the last page.
curl -X GET "https://docuflow.pendral.io/api/v2/audit" \-H "Authorization: Bearer $DOCUFLOW_API_KEY"
{"items": [{"id": "clx9k2m4p0001qh8z3v7d5f2a","actor": {"id": "clx9k2m4p0001qh8z3v7d5f2a","name": "Ada Lovelace","email": "ada@example.com","image": null},"actorType": "actorType","actorLabel": "actorLabel","action": "action","targetType": "targetType","targetId": "clx9k2m4p0001qh8z3v7d5f2a","targetLabel": "targetLabel","summary": "summary","metadata": null,"ip": "ip","userAgent": "userAgent","createdAt": "2026-10-01T12:00:00.000Z"}],"nextCursor": "clx9k2m4p0001qh8z3v7d5f2a"}
Get an audit entry#
One entry of the activity log with its full metadata.
/api/v2/audit/{id}Requires audit:read.
Path parameters
idstringrequired- Audit entry id.
Responses
OK
curl -X GET "https://docuflow.pendral.io/api/v2/audit/{id}" \-H "Authorization: Bearer $DOCUFLOW_API_KEY"
{"entry": {"id": "clx9k2m4p0001qh8z3v7d5f2a","actor": {"id": "clx9k2m4p0001qh8z3v7d5f2a","name": "Ada Lovelace","email": "ada@example.com","image": null},"actorType": "actorType","actorLabel": "actorLabel","action": "action","targetType": "targetType","targetId": "clx9k2m4p0001qh8z3v7d5f2a","targetLabel": "targetLabel","summary": "summary","metadata": null,"ip": "ip","userAgent": "userAgent","createdAt": "2026-10-01T12:00:00.000Z"}}
Workspace, plan and usage#
The workspace this credential is bound to, the plan in force, what it includes, each limit (-1 = unlimited) and how much of it is used — so an integration can see a plan_limit coming instead of meeting a 402. Needs usage:read, which an API key may hold; workspace governance stays with people.
/api/v2/workspaceRequires usage:read.
Responses
OK
curl -X GET "https://docuflow.pendral.io/api/v2/workspace" \-H "Authorization: Bearer $DOCUFLOW_API_KEY"
{"workspace": {"id": "clx9k2m4p0001qh8z3v7d5f2a","name": "Acme Health","slug": "acme-health","personal": false},"plan": "free","granted": false,"expiresAt": null,"enforced": false,"features": ["feature"],"limits": {"key": 1},"usage": {"key": 1}}
Analytics#
Throughput, auto-approval, processing times, field accuracy and usage.
/api/v2/analyticsRequires analytics:read.
Query parameters
period"7d" | "30d" | "90d"- Default
"30d"
Responses
OK
curl -X GET "https://docuflow.pendral.io/api/v2/analytics" \-H "Authorization: Bearer $DOCUFLOW_API_KEY"
{"totals": {},"usage": {}}
Usage#
Pages and cost for billing views (a subset of analytics).
/api/v2/usageRequires usage:read.
Query parameters
period"7d" | "30d" | "90d"- Default
"30d"
Responses
OK
curl -X GET "https://docuflow.pendral.io/api/v2/usage" \-H "Authorization: Bearer $DOCUFLOW_API_KEY"
{"period": "period","usage": {},"documents": 1}