Issue token
Mint a delegated JWT: a doc token, or (API token only) a tenant token.
kind "tenant" requires the API token — authority mints only downward. Mounted only when the deployment can sign (HS256 mode); asymmetric deployments mint with their own private key.
Authentication#
Any one of these credentials is accepted.
The deployment's static root credential (CLOUDPDF_API_AUTH_TOKENS), valid on every surface.
Delegated tenant JWT, valid only under its own /v1/tenants/{tenantId}/ subtree — the path tenant must equal the token's tenant_id. Doc-scoped viewer tokens are rejected on every admin route.
Parameters#
tenantIdpathstringrequiredRequest body#
application/jsonTokensIssueRequestrequiredkind"doc"requiredsubstringrequireddocIdstringrequiredlayerNamestringscopestring[]requireduserIdstringdisplayNamestringgroupIdstringgroupsstring[]originsstring[]expiresInintegerrequiredA complete body for each shape. Strings stand in for your own values.
{
"kind": "doc",
"sub": "sub",
"docId": "docId",
"scope": [
"scope"
],
"expiresIn": 1
}SDK examples#
The selected SDK is remembered across the API reference. Values are examples; replace them with identifiers and input from your application.
This body offers a choice, and the example takes one branch: it sends doc. The request body above carries the other shape — tenant.
import { CloudPDFClient } from "@cloudpdf/sdk";
const client = new CloudPDFClient({
baseUrl: "https://yourhost.com/path/to/api",
token: "<token>",
});
await client.tokens.issue({
tenantId: "tenantId",
body: {
kind: "doc",
sub: "sub",
docId: "docId",
scope: ["scope"],
expiresIn: 1
}
});Responses#
application/jsonTokensIssue200ResponsetokenstringjtistringexpiresAtnumberapplication/jsonTokensIssue400Responseerrorobjectcodestringmessagestringapplication/jsonTokensIssue403Responseerrorobjectcodestringmessagestringapplication/jsonTokensIssue404Responseerrorobjectcodestringmessagestringapplication/jsonAdminErrorPayloaderrorobjectcodestringmessagestring