CloudPDF
DocsPricing
Start building

Issue token

POST/v1/tenants/{tenantId}/tokensv3.0.0-next.9

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.

API token

The deployment's static root credential (CLOUDPDF_API_AUTH_TOKENS), valid on every surface.

Tenant token

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.

Required scopetokens.issue-doc

Parameters#

tenantIdpathstringrequired

Request body#

application/jsonTokensIssueRequestrequired
kind =
kind"doc"required
substringrequired
docIdstringrequired
layerNamestring
scopestring[]required
userIdstring
displayNamestring
groupIdstring
groupsstring[]
originsstring[]
expiresInintegerrequired

A 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#

200OK
application/jsonTokensIssue200Response
tokenstring
jtistring
expiresAtnumber
400Bad request
application/jsonTokensIssue400Response
errorobject
codestring
messagestring
403Forbidden
application/jsonTokensIssue403Response
errorobject
codestring
messagestring
404Not found
application/jsonTokensIssue404Response
errorobject
codestring
messagestring
defaultError
application/jsonAdminErrorPayload
errorobject
codestring
messagestring