Authorization for api.document.service.m7.org
The Document API combines M7 caller admission with current bucket membership and action capabilities. A valid token identifies the actor; a selected organization and bucket determine the resource workspace.
Access tokens and transport
Obtain an M7 access token through the appropriate
SSO authorization flow:
authorization code with PKCE for a user-facing app, device authorization for a
CLI, or client credentials for an eligible confidential application acting
as itself. Document does not issue tokens. Use the SSO discovery document at
https://sso.user.m7.org/.well-known/openid-configuration and its advertised
token endpoint and client authentication policy.
Send a signed compact JWT access token using Authorization: Bearer ACCESS_TOKEN
over HTTPS to https://api.document.service.m7.org. Treat tokens as opaque;
decoding claims does not validate them. ID tokens, refresh packages, device
codes, authorization codes and client secrets do not authenticate resource
requests. Keep credentials out of URLs, JSON bodies, cookies, logs and analytics.
The service checks the RS512 signature, trusted HTTPS certificate source,
validity times, issuer (https://sso.user.m7.org or supported legacy id.m7.org),
and audience https://api.document.service.m7.org. An active canonical
receiving principal is established from signed user projections or a
recipient-authenticated application ACL lookup. Machine ACL decisions use
Document's receiving registration; sender-provided roles do not grant access.
Stored identity references do not override the current admission decision.
Bucket and organization boundaries
Protected bucket, conversion, document and job routes admit receiving roles
member, user, admin, and root. Those roles are distinct from bucket
Management roles and never bypass bucket authority.
| Operation | Resource rule |
|---|---|
| Bucket creation | An admitted user, or authorized organization, with bucket.create; the selected principal becomes owner. A personal application cannot create a bucket. |
| Bucket reads | Active pinned Management membership and the exact bucket capability. |
| Conversion and document operations | Required bucket_id, active membership, and exact convert.* or document.* capability. Jobs are recorded in that bucket. |
| Job reads, cancellation and deletion | Required bucket_id and exact job.* capability. Jobs in another bucket are returned as not found. |
| Membership changes | Owner/admin membership, the exact member capability, and privileged-role/final-owner guards. |
| Bucket deletion | bucket.delete plus explicit confirmation; deletes all bucket jobs and retained payloads. |
See Buckets and membership for fields, response context and
role-specific actions. The job creator's owner remains in returned metadata;
public routes share jobs through bucket authority and reject the owner list
filter. An ID from another bucket cannot expand access.
Omitting organization selection uses the caller's personal workspace. Select
an organization using Org: ORG_UUID or JSON org_id; if both are sent they
must agree. The service obtains fresh recipient-authenticated SSO Management
facts on each selected-organization operation, including reads. It intersects
the organization's capability selections with the bucket membership profile.
Unknown or empty custom selections never grant fallback authority. A verified
empty tag list uses owner/admin defaults; organization members have no automatic
grant. Organization membership or capability names alone do not create bucket
membership. Workspace guidance covers acquisition and proof
transport.
curl --fail-with-body --silent --show-error \
--request POST 'https://api.document.service.m7.org/v1/job/list' \
--header 'Authorization: Bearer ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data '{"bucket_id":"BUCKET_UUID","limit":10}'
Proofs, expiry and revocation
The resource API authenticates Bearer requests and does not validate API-bound
DPoP proofs end to end. An upstream SSO organization request may separately
require an SSO-bound proof in Org-DPoP or orgs_dpop. Bind that proof to the
trusted SSO endpoint, not the Document API URL. Follow the SSO flow's proof
rules for acquisition or refresh; header parsing alone does not protect a
resource request.
Stop using tokens at expiration and obtain replacements from SSO. Send a
refresh package only to SSO, together with its refresh_token, required binding
values, and the owning client's authentication. Never send it to Document.
Client-credentials tokens need a fresh client authentication rather than a user
refresh session. Revoke eligible credentials at the SSO revocation endpoint,
then discard them. See the
SSO lifecycle contract.
Admission and membership changes can remove access before token expiry. Signed user tokens are checked locally; do not treat a resource request as token introspection or assume immediate revocation propagation. Application admission additionally depends on current receiver ACL policy. Bucket and job retention are separate from access-token lifetime.
Failures
Roster admission returns HTTP 401 for missing/invalid tokens or unsupported
sender proof, 503 for missing receiver configuration or failed ACL lookup,
and 403 for denied receiving status or role. For example:
{
"status": 0,
"comment": "Access denied",
"data": {"code":401,"reason":"missing_token","boundary":"roster"}
}
| HTTP status | Client action |
|---|---|
400 |
Correct missing/invalid bucket_id, conflicting organization selection, request fields or confirmation. |
401 |
Obtain a valid admitted access token. |
403 |
Reload workspace/bucket context and correct receiving admission, membership or action grant. |
404 |
Check the resource ID and selected bucket; another bucket's job is not disclosed. |
409 |
Reload current membership/state before retrying a busy or conflicting mutation. |
503 |
Retry after receiver/ACL or capability catalogue availability is restored. |
Other resource errors may omit code or reason in JSON. Always handle HTTP
status and application status; human-readable comments are diagnostic.
Keep confidential client secrets on a trusted backend and protect access/refresh
credentials according to their lifetime. Resource UUIDs are references, not
credentials.