Choose scopes from what the service calls
List the operations a service calls and grant only their scopes. Starting broad and narrowing later rarely happens: extra permissions quietly become dependencies.
- Give processing (documents.process) and document management (documents.write) separate keys when different services own them.
- Give reporting jobs read scopes only.
- Never share a production key with developer machines or CI fixtures.
Keep a key inventory
| Field | Record | Never record |
|---|---|---|
| Name | Service and environment | The key itself |
| Responsible team | Who maintains the key | Personal passwords |
| Scopes | Why each one is needed | Unexplained broad access |
| Created and rotated | Dates and change reference | The key in a ticket |
| Usage | Last used and a request summary | Request bodies |
Storing keys at run time
- Load keys from environment variables or a secret manager.
- Keep modules that read keys out of client bundles and static builds.
- Mask key-like values in logs and error reports.
- Let only the process that calls the API read the key.
Regular review
After deployments and on a regular schedule, look for unused keys, unexpected scope use, keys nobody is responsible for any more and keys in the wrong environment. Revoke a key once you have confirmed nothing still uses it.
Scope catalog
Each row lists exactly the v2 operations that require the scope (paths are relative to https://wellfriend.dev). Grant a key only the scopes for the operations its service calls; a call without every required scope returns 403 SCOPE_FORBIDDEN with details.requiredScopes.
| Scope | Allows |
|---|---|
| analytics.read | GET /api/v2/documents/{documentId}/analytics; GET /api/v2/secure-links/{linkId}/analytics; GET /api/v2/rooms/{roomId}/analytics; GET /api/v2/portals/{portalId}/analytics |
| connectors.read | GET /api/v2/connector-accounts; GET /api/v2/connector-accounts/{accountId}/items; GET /api/v2/connector-operations |
| connectors.write | POST /api/v2/connector-accounts/{accountId}/test; POST /api/v2/connector-accounts/{accountId}/disconnect; POST /api/v2/connector-imports; POST /api/v2/connector-sends; POST /api/v2/connector-exports; POST /api/v2/generic-http-connections |
| documents.process | POST /api/v2/document-operations; POST /api/v2/document-chains; POST /api/v2/document-chains/{chainId}/cancel; POST /api/v2/document-chains/{chainId}/resume |
| documents.read | GET /api/v2/documents; GET /api/v2/documents/{documentId}; GET /api/v2/document-operations/{operationId}; GET /api/v2/document-operations/{operationId}/outputs; GET /api/v2/document-chains/{chainId}; GET /api/v2/document-chains/{chainId}/events; POST /api/v2/connector-exports; GET /api/v2/documents/{documentId}/versions; GET /api/v2/documents/{documentId}/versions/{versionId}; GET /api/v2/documents/{documentId}/versions/{versionId}/content; GET /api/v2/documents/{documentId}/versions/{versionId}/pages/{page}/render |
| documents.write | POST /api/v2/documents; POST /api/v2/uploads; GET /api/v2/uploads/{uploadId}; DELETE /api/v2/uploads/{uploadId}; PUT /api/v2/uploads/{uploadId}/parts/{index}; POST /api/v2/uploads/{uploadId}/complete; POST /api/v2/connector-imports |
| embeds.read | GET /api/v2/embed-sessions/{sessionId} |
| embeds.write | POST /api/v2/embed-sessions; POST /api/v2/embed-sessions/{sessionId}/refresh; POST /api/v2/embed-sessions/{sessionId}/revoke |
| esign.read | GET /api/v2/esign/levels; GET /api/v2/esign/envelopes; GET /api/v2/esign/envelopes/{envelopeId}; GET /api/v2/esign/envelopes/{envelopeId}/certificate |
| esign.validate | POST /api/v2/esign/validate |
| esign.write | POST /api/v2/esign/envelopes; POST /api/v2/esign/envelopes/{envelopeId}/cancel |
| keys.read | GET /api/v2/keys |
| keys.write | POST /api/v2/keys; POST /api/v2/keys/{keyId}/revoke; POST /api/v2/keys/{keyId}/rotate |
| links.read | GET /api/v2/secure-links; GET /api/v2/secure-links/{linkId}; POST /api/v2/connector-sends; GET /api/v2/secure-links/{linkId}/recipients; GET /api/v2/secure-links/{linkId}/sessions |
| links.write | POST /api/v2/secure-links; PATCH /api/v2/secure-links/{linkId}; POST /api/v2/secure-links/{linkId}/revoke; POST /api/v2/secure-links/{linkId}/version; POST /api/v2/secure-links/{linkId}/recipients; POST /api/v2/secure-links/{linkId}/password; POST /api/v2/secure-links/{linkId}/sessions/{sessionId}/revoke |
| logs.read | GET /api/v2/logs |
| mcp.invoke | POST /mcp |
| resources.read | GET /api/v2/templates; GET /api/v2/templates/{resourceId}; GET /api/v2/signature-requests; GET /api/v2/signature-requests/{resourceId}; GET /api/v2/annotations; GET /api/v2/annotations/{resourceId}; GET /api/v2/forms; GET /api/v2/forms/{resourceId}; GET /api/v2/deal-rooms; GET /api/v2/deal-rooms/{resourceId}; GET /api/v2/embeds; GET /api/v2/embeds/{resourceId} |
| resources.write | POST /api/v2/templates; PATCH /api/v2/templates/{resourceId}; POST /api/v2/templates/{resourceId}/actions; POST /api/v2/signature-requests; PATCH /api/v2/signature-requests/{resourceId}; POST /api/v2/signature-requests/{resourceId}/actions; POST /api/v2/annotations; PATCH /api/v2/annotations/{resourceId}; POST /api/v2/annotations/{resourceId}/actions; POST /api/v2/forms; PATCH /api/v2/forms/{resourceId}; POST /api/v2/forms/{resourceId}/actions; POST /api/v2/deal-rooms; PATCH /api/v2/deal-rooms/{resourceId}; POST /api/v2/deal-rooms/{resourceId}/actions; POST /api/v2/embeds; PATCH /api/v2/embeds/{resourceId}; POST /api/v2/embeds/{resourceId}/actions |
| rooms.access | POST /api/v2/rooms/{roomId}/participants; PATCH /api/v2/rooms/{roomId}/participants/{participantId}; POST /api/v2/rooms/{roomId}/permissions; DELETE /api/v2/rooms/{roomId}/permissions/{permissionId} |
| rooms.read | GET /api/v2/rooms; GET /api/v2/rooms/{roomId}; GET /api/v2/rooms/{roomId}/contents; GET /api/v2/portals; GET /api/v2/portals/{portalId} |
| rooms.write | POST /api/v2/rooms; POST /api/v2/rooms/{roomId}/actions; POST /api/v2/rooms/{roomId}/folders; PATCH /api/v2/rooms/{roomId}/folders/{folderId}; POST /api/v2/rooms/{roomId}/documents; PATCH /api/v2/rooms/{roomId}/documents/{roomDocumentId}; POST /api/v2/rooms/{roomId}/requests; POST /api/v2/rooms/{roomId}/questions; POST /api/v2/rooms/{roomId}/questions/{questionId}/answers; POST /api/v2/portals; PATCH /api/v2/portals/{portalId}; POST /api/v2/portals/{portalId}/actions; POST /api/v2/portals/{portalId}/rooms; POST /api/v2/portals/{portalId}/announcements; POST /api/v2/portals/{portalId}/resources |
| usage.read | GET /api/v2/usage |
| webhooks.read | POST /api/v2/webhooks/verify; GET /api/v2/webhook-endpoints; GET /api/v2/webhook-endpoints/{endpointId}; GET /api/v2/webhook-deliveries; GET /api/v2/webhook-endpoints/{endpointId}/insights; GET /api/v2/webhook-deliveries/{deliveryId} |
| webhooks.write | POST /api/v2/webhook-endpoints; PATCH /api/v2/webhook-endpoints/{endpointId}; DELETE /api/v2/webhook-endpoints/{endpointId}; POST /api/v2/webhook-endpoints/{endpointId}/test; POST /api/v2/webhook-deliveries/{deliveryId}/replay; POST /api/v2/webhook-endpoints/{endpointId}/rotate-secret; POST /api/v2/webhook-endpoints/{endpointId}/replay |
| workflows.approve | POST /api/v2/workflow-approvals/{approvalId}/decision |
| workflows.execute | POST /api/v2/workflows/{workflowId}/runs; POST /api/v2/workflow-runs/{runId}/cancel; POST /api/v2/workflow-runs/{runId}/replay |
| workflows.read | GET /api/v2/workflows; GET /api/v2/workflows/{workflowId}; GET /api/v2/workflow-runs/{runId} |
| workflows.write | POST /api/v2/workflows/validate; POST /api/v2/workflows; PATCH /api/v2/workflows/{workflowId}; POST /api/v2/workflows/{workflowId}/publish |