Platform

Building a workflow on top of DocuFlow. whoami says what a credential can do, /events/log is the webhook feed as something you poll, /batch collapses several calls into one round trip, and /logs shows what your integration actually sent.

Introspect this credential#

What this key or session is, which workspace it acts in, exactly what it may do, and how much of its rate-limit budget is left. Needs no permission beyond a valid credential — the first call to make when integrating, and the first one to make when something unexpectedly returns 403.

GET/api/v2/whoami

Any valid API key or signed-in session. No permission needed.

Responses

OK

curl -X GET "https://docuflow.pendral.io/api/v2/whoami" \
-H "Authorization: Bearer $DOCUFLOW_API_KEY"
Response200
{
"principal": {
"kind": "user",
"id": "clx9k2m4p0001qh8z3v7d5f2a",
"label": "Accounts payable sync",
"user": {
"id": "clx9k2m4p0001qh8z3v7d5f2a",
"email": "ada@example.com",
"name": "Ada Lovelace"
},
"platformAdmin": false
},
"apiKey": {
"id": "clx9k2m4p0001qh8z3v7d5f2a",
"name": "Accounts payable sync",
"prefix": "dfk_live_7Hq2",
"scopes": [
"documents:read",
"documents:create"
]
},
"workspace": {
"id": "clx9k2m4p0001qh8z3v7d5f2a",
"name": "Acme Health",
"slug": "acme-health",
"personal": false
},
"permissions": [
"documents:read",
"documents:create",
"queues:read"
],
"queueScope": [
{
"id": "clx9k2m4p0001qh8z3v7d5f2a",
"name": "Invoices",
"slug": "invoices"
}
],
"rateLimit": {
"limit": 600,
"remaining": 598,
"resetAt": "2026-10-01T12:00:00.000Z",
"window": "1 minute"
},
"api": {
"version": "v2",
"baseUrl": "https://docuflow.pendral.io/api/v2",
"openapi": "https://docuflow.pendral.io/api/v2/openapi"
}
}

Run several API calls in one request#

Up to 25 v2 calls over one connection. Each is dispatched through the API itself, so it is authorized, validated and rate-limited exactly as the direct call would be — a batch can never reach something the caller could not already call. parallel runs everything and reports each outcome; sequential stops at the first failure and marks the rest skipped (status 0).

The outer response is 200 whenever the batch itself ran: read each result's own status. Uploads are multipart and are not batchable.

POST/api/v2/batch

Any valid API key or signed-in session. No permission needed.

Body

application/json
requestsobject[]required
mode"parallel" | "sequential"
sequential stops at the first failure; parallel runs everything and reports each outcome.
Default"parallel"

Responses

OK

curl -X POST "https://docuflow.pendral.io/api/v2/batch" \
-H "Authorization: Bearer $DOCUFLOW_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"requests": [
{
"method": "GET",
"path": "invoiceTotal",
"body": "Please confirm the PO number with the supplier."
}
]
}'
Response200
{
"results": [
{
"id": "clx9k2m4p0001qh8z3v7d5f2a",
"method": "GET",
"path": "invoiceTotal",
"status": 1,
"body": "Please confirm the PO number with the supplier.",
"error": "error",
"durationMs": 184
}
],
"summary": {
"total": 1,
"succeeded": 1,
"failed": 1,
"durationMs": 184
}
}

Poll the event feed#

Every event the workspace has produced, whether or not a webhook was subscribed — the pull half of the webhook feed, carrying the same evt_… ids and the same bodies.

Consume it forward: take a page, handle it, keep nextCursor, ask for what comes after. since is only for a first poll that has no cursor yet. Delivery is at least once on both halves, so deduplicate on the event id. Events are kept 30 days.

GET/api/v2/events/log

Requires documents:read on the queue it touches.queue-scopedcursor-paginated

Query parameters

typestring | string[]
One or more event types (repeat the parameter). Omit for every type.
documentIdstring
queueIdstring
afterstring
Cursor from a previous page's nextCursor. Returns events strictly after it.
sincestring
ISO timestamp floor, for a first poll with no cursor.
untilstring
order"asc" | "desc"
asc is the order a feed is consumed in; desc reads newest first.
Default"asc"
limitinteger
Default50

Responses

OK. Cursor-paginated: pass nextCursor back as cursor; null means the last page.

curl -X GET "https://docuflow.pendral.io/api/v2/events/log" \
-H "Authorization: Bearer $DOCUFLOW_API_KEY"
Response200
{
"events": [
"document.approved",
"document.needs_review"
],
"nextCursor": "clx9k2m4p0001qh8z3v7d5f2a",
"hasMore": false
}

Read one event#

Including envelope — the exact body a webhook was sent.

GET/api/v2/events/log/{id}

Requires documents:read on the queue it touches.queue-scoped

Path parameters

idstringrequired
Event id (evt_…).

Responses

OK

curl -X GET "https://docuflow.pendral.io/api/v2/events/log/{id}" \
-H "Authorization: Bearer $DOCUFLOW_API_KEY"
Response200
{
"event": {
"id": "clx9k2m4p0001qh8z3v7d5f2a",
"type": "document.received",
"createdAt": "2026-10-01T12:00:00.000Z",
"cursor": "clx9k2m4p0001qh8z3v7d5f2a",
"documentId": "clx9k2m4p0001qh8z3v7d5f2a",
"queueId": "clx9k2m4p0001qh8z3v7d5f2a",
"data": null,
"envelope": null
}
}

Replay an event to webhooks#

Re-sends the stored envelope verbatim, so what arrives is what the endpoint missed rather than what the document looks like now. Without webhookId it goes to every enabled webhook subscribed to the event type; with one it goes to that webhook regardless of its subscription. Returns 202 — deliveries are queued.

POST/api/v2/events/log/{id}/replay

Requires webhooks:manage.

Path parameters

idstringrequired
Event id (evt_…).

Body

application/json
webhookIdstring
Replay to one webhook (overriding its subscription). Omit to replay to every subscribed webhook.

Responses

OK

curl -X POST "https://docuflow.pendral.io/api/v2/events/log/{id}/replay" \
-H "Authorization: Bearer $DOCUFLOW_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'
Response202
{
"deliveries": [
{
"id": "clx9k2m4p0001qh8z3v7d5f2a",
"webhookId": "clx9k2m4p0001qh8z3v7d5f2a",
"url": "https://hooks.example.com/docuflow"
}
]
}

Event catalog#

Every event type, what it means and whether it carries extracted fields. Render this instead of hard-coding a list that goes stale.

GET/api/v2/events/types

Requires documents:read.

Responses

OK

curl -X GET "https://docuflow.pendral.io/api/v2/events/types" \
-H "Authorization: Bearer $DOCUFLOW_API_KEY"
Response200
{
"events": [
{
"type": "document.received",
"description": "Supplier invoices from the accounts payable mailbox.",
"carriesFields": false
}
],
"retentionDays": 1
}

Your recent API calls#

Method, path, status, error code, duration and request id for the workspace's own API traffic, newest first. Request and response bodies are never recorded, so nothing here can contain a document.

A rolling window of the last ~2,000 calls (7 days), for debugging an integration. The permanent record of what changed is /api/v2/audit.

GET/api/v2/logs

Requires audit:read.cursor-paginated

Query parameters

cursorstring
limitinteger
Default50
statusinteger
Exact response status.
outcome"ok" | "error"
error is any 4xx or 5xx.
method"GET" | "POST" | "PATCH" | "PUT" | "DELETE"
apiKeyIdstring
pathstring
Substring match on the path.
requestIdstring

Responses

OK. Cursor-paginated: pass nextCursor back as cursor; null means the last page.

curl -X GET "https://docuflow.pendral.io/api/v2/logs" \
-H "Authorization: Bearer $DOCUFLOW_API_KEY"
Response200
{
"entries": [
{
"id": "clx9k2m4p0001qh8z3v7d5f2a",
"at": "2026-10-01T12:00:00.000Z",
"method": "GET",
"path": "invoiceTotal",
"query": "query",
"status": 1,
"code": "7KQ2-9XDM",
"durationMs": 184,
"requestId": "3f6c1a52-8d0e-4b7a-9c1e-2a4b6d8f0e13",
"principal": "user",
"apiKeyId": "clx9k2m4p0001qh8z3v7d5f2a",
"apiKeyName": "apiKeyName",
"userId": "clx9k2m4p0001qh8z3v7d5f2a",
"ip": "ip",
"userAgent": "userAgent",
"idempotencyKey": "idempotencyKey",
"replayed": false
}
],
"nextCursor": "clx9k2m4p0001qh8z3v7d5f2a",
"hasMore": false,
"window": {
"entries": 1,
"retentionDays": 1
}
}