Members & access
Members, invitations, roles and teams. Governance needs a signed-in person: API keys can never call these.
Rename the active workspace#
Rename the active workspace
/api/orgs/currentRequires org:manage.
Needs a signed-in person: API keys can't call this.
Body
application/jsonnamestringslugstring
Responses
OK
curl -X PATCH "https://docuflow.pendral.io/api/orgs/current" \-H "Cookie: __Secure-better-auth.session_token=$DOCUFLOW_SESSION" \-H "Content-Type: application/json" \-d '{"name": "Invoices","slug": "invoices"}'
{"organization": {"id": "clx9k2m4p0001qh8z3v7d5f2a","name": "Invoices","slug": "invoices"}}
Delete the active workspace#
Send the workspace slug as confirm. Personal workspaces can't be deleted.
/api/orgs/currentRequires org:delete.
Needs a signed-in person: API keys can't call this.
Body
application/jsonconfirmstringrequired
Responses
OK
curl -X DELETE "https://docuflow.pendral.io/api/orgs/current" \-H "Cookie: __Secure-better-auth.session_token=$DOCUFLOW_SESSION" \-H "Content-Type: application/json" \-d '{"confirm": "confirm"}'
{"ok": true}
The workspace's plan and usage#
The plan in force, what it includes, each limit (-1 = unlimited) and how much of it is used. A request the plan doesn't allow answers 402 with code plan_required (a feature) or plan_limit (a limit), and names the plan that lifts it.
/api/orgs/planRequires org:read.
Needs a signed-in person: API keys can't call this.
Responses
OK
curl -X GET "https://docuflow.pendral.io/api/orgs/plan" \-H "Cookie: __Secure-better-auth.session_token=$DOCUFLOW_SESSION"
{"plan": "free","expiresAt": null,"features": ["feature"],"limits": {"key": 1},"usage": {"key": 1}}
Transfer ownership#
The target becomes Owner; you become Admin.
/api/orgs/transferRequires org:delete.
Needs a signed-in person: API keys can't call this.
Body
application/jsonuserIdstringrequired
Responses
OK
curl -X POST "https://docuflow.pendral.io/api/orgs/transfer" \-H "Cookie: __Secure-better-auth.session_token=$DOCUFLOW_SESSION" \-H "Content-Type: application/json" \-d '{"userId": "clx9k2m4p0001qh8z3v7d5f2a"}'
{"ok": true}
Members, invitations, roles and grants#
Everything the members screen needs: members with grants and teams, pending invitations, assignable roles and queues.
/api/orgs/membersRequires members:read.
Needs a signed-in person: API keys can't call this.
Responses
OK
curl -X GET "https://docuflow.pendral.io/api/orgs/members" \-H "Cookie: __Secure-better-auth.session_token=$DOCUFLOW_SESSION"
{"members": [{"userId": "clx9k2m4p0001qh8z3v7d5f2a","email": "ada@example.com"}],"invitations": [{"id": "clx9k2m4p0001qh8z3v7d5f2a","email": "ada@example.com","role": "role","expiresAt": "2026-10-01T12:00:00.000Z","createdAt": "2026-10-01T12:00:00.000Z"}],"roles": [{"id": "clx9k2m4p0001qh8z3v7d5f2a","key": "invoiceNumber","name": "Invoices","description": "Supplier invoices from the accounts payable mailbox.","isBuiltin": false,"permissions": {}}],"queues": [{"id": "clx9k2m4p0001qh8z3v7d5f2a","name": "Invoices"}],"me": {"userId": "clx9k2m4p0001qh8z3v7d5f2a"}}
Change a member's role and queue grants#
Change a member's role and queue grants
/api/orgs/membersRequires members:manage.
Needs a signed-in person: API keys can't call this.
Body
application/jsonuserIdstringrequiredrolestringrequiredqueueGrantsobject[]
Responses
OK
curl -X PATCH "https://docuflow.pendral.io/api/orgs/members" \-H "Cookie: __Secure-better-auth.session_token=$DOCUFLOW_SESSION" \-H "Content-Type: application/json" \-d '{"userId": "clx9k2m4p0001qh8z3v7d5f2a","role": "role"}'
{"ok": true}
Remove a member, or leave#
Removing someone else needs members:manage; anyone may remove themselves.
/api/orgs/membersAny valid API key or signed-in session. No permission needed.
Query parameters
userIdstringrequired- Member to remove.
Responses
OK
curl -X DELETE "https://docuflow.pendral.io/api/orgs/members?userId=userId" \-H "Authorization: Bearer $DOCUFLOW_API_KEY"
{"ok": true}
Pending invitations#
Pending invitations
/api/orgs/invitesRequires members:read.
Needs a signed-in person: API keys can't call this.
Responses
OK
curl -X GET "https://docuflow.pendral.io/api/orgs/invites" \-H "Cookie: __Secure-better-auth.session_token=$DOCUFLOW_SESSION"
{"invites": [{"id": "clx9k2m4p0001qh8z3v7d5f2a","email": "ada@example.com","role": "role","expiresAt": "2026-10-01T12:00:00.000Z","createdAt": "2026-10-01T12:00:00.000Z"}]}
Invite by email#
Invite by email
/api/orgs/invitesRequires members:invite.
Needs a signed-in person: API keys can't call this.
Body
application/jsonemailstringrequiredrolestring- Default
"reviewer"
Responses
OK
curl -X POST "https://docuflow.pendral.io/api/orgs/invites" \-H "Cookie: __Secure-better-auth.session_token=$DOCUFLOW_SESSION" \-H "Content-Type: application/json" \-d '{"email": "ada@example.com"}'
{"inviteId": "clx9k2m4p0001qh8z3v7d5f2a","emailSent": false}
Revoke an invitation#
Revoke an invitation
/api/orgs/invitesRequires members:invite.
Needs a signed-in person: API keys can't call this.
Query parameters
idstringrequired- Invitation id.
Responses
OK
curl -X DELETE "https://docuflow.pendral.io/api/orgs/invites?id=id" \-H "Cookie: __Secure-better-auth.session_token=$DOCUFLOW_SESSION"
{"ok": true}
Resend an invitation#
Resend an invitation
/api/orgs/invites/{id}/resendRequires members:invite.
Needs a signed-in person: API keys can't call this.
Path parameters
idstringrequired- Invitation id.
Responses
OK
curl -X POST "https://docuflow.pendral.io/api/orgs/invites/{id}/resend" \-H "Cookie: __Secure-better-auth.session_token=$DOCUFLOW_SESSION"
{"ok": true,"emailSent": false}
Role catalog#
Built-in and custom roles plus the permission statement they draw from.
/api/orgs/rolesRequires roles:read.
Needs a signed-in person: API keys can't call this.
Responses
OK
curl -X GET "https://docuflow.pendral.io/api/orgs/roles" \-H "Cookie: __Secure-better-auth.session_token=$DOCUFLOW_SESSION"
{"roles": [{"id": "clx9k2m4p0001qh8z3v7d5f2a","key": "invoiceNumber","name": "Invoices","description": "Supplier invoices from the accounts payable mailbox.","isBuiltin": false,"permissions": {}}],"statement": {"key": ["string"]},"queueScopedModules": ["queueScopedModule"],"canManage": false}
Create a custom role#
Create a custom role
/api/orgs/rolesRequires roles:manage.
Needs a signed-in person: API keys can't call this.
Body
application/jsonnamestringrequireddescriptionstring | nullpermissionsRecord<string, string[]>- Default
{}
Responses
OK
curl -X POST "https://docuflow.pendral.io/api/orgs/roles" \-H "Cookie: __Secure-better-auth.session_token=$DOCUFLOW_SESSION" \-H "Content-Type: application/json" \-d '{"name": "Invoices","description": "Supplier invoices from the accounts payable mailbox."}'
{"role": {"id": "clx9k2m4p0001qh8z3v7d5f2a","key": "invoiceNumber","name": "Invoices","description": "Supplier invoices from the accounts payable mailbox.","isBuiltin": false,"permissions": {"key": ["string"]}}}
Edit a custom role#
Built-in roles are immutable; duplicate one instead.
/api/orgs/roles/{id}Requires roles:manage.
Needs a signed-in person: API keys can't call this.
Path parameters
idstringrequired- Role id.
Body
application/jsonnamestringdescriptionstring | nullpermissionsRecord<string, string[]>
Responses
OK
curl -X PATCH "https://docuflow.pendral.io/api/orgs/roles/{id}" \-H "Cookie: __Secure-better-auth.session_token=$DOCUFLOW_SESSION" \-H "Content-Type: application/json" \-d '{"name": "Invoices","description": "Supplier invoices from the accounts payable mailbox."}'
{"role": {"id": "clx9k2m4p0001qh8z3v7d5f2a","key": "invoiceNumber","name": "Invoices","description": "Supplier invoices from the accounts payable mailbox.","isBuiltin": false,"permissions": {"key": ["string"]}}}
Delete a custom role#
Only roles nobody holds.
/api/orgs/roles/{id}Requires roles:manage.
Needs a signed-in person: API keys can't call this.
Path parameters
idstringrequired- Role id.
Responses
OK
curl -X DELETE "https://docuflow.pendral.io/api/orgs/roles/{id}" \-H "Cookie: __Secure-better-auth.session_token=$DOCUFLOW_SESSION"
{"ok": true}
List teams#
List teams
/api/orgs/teamsRequires teams:read.
Needs a signed-in person: API keys can't call this.
Responses
OK
curl -X GET "https://docuflow.pendral.io/api/orgs/teams" \-H "Cookie: __Secure-better-auth.session_token=$DOCUFLOW_SESSION"
{"teams": [{"id": "clx9k2m4p0001qh8z3v7d5f2a","name": "Invoices","description": "Supplier invoices from the accounts payable mailbox."}],"canManage": false}
Create a team#
Create a team
/api/orgs/teamsRequires teams:manage.
Needs a signed-in person: API keys can't call this.
Body
application/jsonnamestringrequireddescriptionstring | null
Responses
OK
curl -X POST "https://docuflow.pendral.io/api/orgs/teams" \-H "Cookie: __Secure-better-auth.session_token=$DOCUFLOW_SESSION" \-H "Content-Type: application/json" \-d '{"name": "Invoices","description": "Supplier invoices from the accounts payable mailbox."}'
{"team": {"id": "clx9k2m4p0001qh8z3v7d5f2a","name": "Invoices"}}
Update a team#
Rename, replace members, and/or replace what the team grants.
/api/orgs/teams/{id}Requires teams:manage.
Needs a signed-in person: API keys can't call this.
Path parameters
idstringrequired- Team id.
Body
application/jsonnamestringdescriptionstring | nullmemberIdsstring[]roleIdOrKeystring | nullqueueGrantsobject[]
Responses
OK
curl -X PATCH "https://docuflow.pendral.io/api/orgs/teams/{id}" \-H "Cookie: __Secure-better-auth.session_token=$DOCUFLOW_SESSION" \-H "Content-Type: application/json" \-d '{"name": "Invoices","description": "Supplier invoices from the accounts payable mailbox."}'
{"ok": true}
Delete a team#
Delete a team
/api/orgs/teams/{id}Requires teams:manage.
Needs a signed-in person: API keys can't call this.
Path parameters
idstringrequired- Team id.
Responses
OK
curl -X DELETE "https://docuflow.pendral.io/api/orgs/teams/{id}" \-H "Cookie: __Secure-better-auth.session_token=$DOCUFLOW_SESSION"
{"ok": true}
List members#
Members for assignee pickers. Pending invitations are included only for callers holding members:read.
/api/v2/membersRequires documents:read.
Responses
OK
curl -X GET "https://docuflow.pendral.io/api/v2/members" \-H "Authorization: Bearer $DOCUFLOW_API_KEY"
{"members": [{"id": "clx9k2m4p0001qh8z3v7d5f2a","userId": "clx9k2m4p0001qh8z3v7d5f2a","name": "Ada Lovelace","email": "ada@example.com","image": null,"role": "role","roleName": "roleName","joinedAt": "2026-10-01T12:00:00.000Z","lastActiveAt": "2026-10-01T12:00:00.000Z"}],"invitations": [{"id": "clx9k2m4p0001qh8z3v7d5f2a","email": "ada@example.com","role": "role","expiresAt": "2026-10-01T12:00:00.000Z","createdAt": "2026-10-01T12:00:00.000Z","invitedBy": "invitedBy","link": "https://docuflow.pendral.io/join/7KQ2-9XDM"}]}
Change a member's role#
Change a member's role
/api/v2/members/{userId}Requires members:manage.
Needs a signed-in person: API keys can't call this.
Path parameters
userIdstringrequired- Member's user id.
Body
application/jsonrolestringrequiredqueueGrantsobject[]
Responses
OK
curl -X PATCH "https://docuflow.pendral.io/api/v2/members/{userId}" \-H "Cookie: __Secure-better-auth.session_token=$DOCUFLOW_SESSION" \-H "Content-Type: application/json" \-d '{"role": "role"}'
{"ok": true,"role": "role"}
Remove a member, or leave#
Removing someone else needs members:manage; anyone may remove themselves.
/api/v2/members/{userId}Any valid API key or signed-in session. No permission needed.
Path parameters
userIdstringrequired- Member's user id.
Responses
OK
curl -X DELETE "https://docuflow.pendral.io/api/v2/members/{userId}" \-H "Authorization: Bearer $DOCUFLOW_API_KEY"
{"ok": true}
Invite a member#
Invite a member
/api/v2/invitationsRequires members:invite.
Needs a signed-in person: API keys can't call this.
Body
application/jsonemailstringrequiredrolestring- Default
"reviewer"
Responses
OK
curl -X POST "https://docuflow.pendral.io/api/v2/invitations" \-H "Cookie: __Secure-better-auth.session_token=$DOCUFLOW_SESSION" \-H "Content-Type: application/json" \-d '{"email": "ada@example.com"}'
{"invitation": {"id": "clx9k2m4p0001qh8z3v7d5f2a","email": "ada@example.com","role": "role","expiresAt": "2026-10-01T12:00:00.000Z","createdAt": "2026-10-01T12:00:00.000Z"},"emailSent": false}
Revoke an invitation#
Revoke an invitation
/api/v2/invitations/{id}Requires members:invite.
Needs a signed-in person: API keys can't call this.
Path parameters
idstringrequired- Invitation id.
Responses
OK
curl -X DELETE "https://docuflow.pendral.io/api/v2/invitations/{id}" \-H "Cookie: __Secure-better-auth.session_token=$DOCUFLOW_SESSION"
{"ok": true}
Resend an invitation#
Resend an invitation
/api/v2/invitations/{id}/resendRequires members:invite.
Needs a signed-in person: API keys can't call this.
Path parameters
idstringrequired- Invitation id.
Responses
OK
curl -X POST "https://docuflow.pendral.io/api/v2/invitations/{id}/resend" \-H "Cookie: __Secure-better-auth.session_token=$DOCUFLOW_SESSION"
{"ok": true,"emailSent": false}
Delete the workspace#
Send the workspace slug as confirm.
/api/v2/settingsRequires org:delete.
Needs a signed-in person: API keys can't call this.
Body
application/jsonconfirmstringrequired
Responses
OK
curl -X DELETE "https://docuflow.pendral.io/api/v2/settings" \-H "Cookie: __Secure-better-auth.session_token=$DOCUFLOW_SESSION" \-H "Content-Type: application/json" \-d '{"confirm": "confirm"}'
{"ok": true}