POST /api/v1/orgs/{id}/members/{principal}/tokens · Operation ID: issueManagedTokenorgs:manage. tokens.manage: teacher or billing; orgs:manage and plan managedTokens feature.curl --fail-with-body -X POST 'https://handwrites.io/api/v1/orgs/REPLACE_ORG_ID/members/user%3AREPLACE_USER_ID/tokens' \
-H "Authorization: Bearer $HANDWRITE_API_TOKEN" \
-H 'Content-Type: application/json' \
--data '{"name":"Approved reading integration","permissions":{"documents":"read","orgs":"read"},"documents":["doc_Ab3dEf6hIj9kLm0n"],"expiresInDays":7}'| Name | In | Required | Details |
|---|---|---|---|
id | path | Yes | An organisation ID (org_…). |
principal | path | Yes | A principal, URL-encoded (user%3A…). |
application/json (required).| Field | Required | Details |
|---|---|---|
name | Yes | {"type":"string","maxLength":60} |
permissions | Yes | {"type":"object","additionalProperties":{"type":"string"}} |
documents | No | {"oneOf":[{"const":"all"},{"type":"array","items":{"type":"string"},"maxItems":50}]} |
expiresInDays | Yes | {"type":"integer","minimum":1,"maximum":30} |
| Status | Meaning | Format |
|---|---|---|
| 201 | The token and its secret. | application/json |
| 400 | invalid_request (the message names the field), validation_failed. | application/json |
| 401 | unauthorized: no token, or it's invalid, revoked or expired. | application/json |
| 403 | insufficient_scope, forbidden (you can see it but not do this), app_test_restricted, account_deleted (the account is scheduled for deletion; any request). | application/json |
| 404 | not_found: it doesn't exist or you can't see it (never 403 for documents you can't see). | application/json |
| 422 | limit_reached, idempotency_mismatch, unreadable_file, no_text, empty_document. | application/json |
| 429 | rate_limited (burst or daily cap) or quota_exceeded (no characters left). | application/json |
| 500 | internal_error. | application/json |