API keys
An API key lets your server use CloudPDF for your workspace: upload documents, make tokens for your users, and manage grants. It stays on your server. Browsers never get it: they open documents with a grant or a token your server makes.
Owners and admins make and revoke keys. Everyone in the workspace sees the list.
Make one#
Click New API key, name it after where it runs (“Production server”, “Fernquill app”), and choose how long it lives: 30, 60 or 90 days.
Then choose what it can do:
- Full access: everything you can do in the dashboard. Right for your own scripts.
- Restricted: only what you turn on below. Right for an app in production.
| Row | Lets the key | Choices |
|---|---|---|
| Documents and folders | List them (Read), and upload, rename and move them, and make upload tokens (Write) | None, Read, Write |
| Delete | Delete documents and folders | Off, On |
| Inside documents | Pages, text, annotations, forms and attached files: read them, download and copy text (Read), or also change, print and sign (Write) | None, Read, Write |
| Viewer tokens | Make tokens for your users, and revoke them | Off, On |
| Grants | Make, change and end grants | Off, On |
A key’s viewer tokens and grants give only what the key itself may do inside documents. So with either one on, Inside documents can’t be None. Set it to Write for tokens and grants that let people comment, fill in forms, sign or print.
When your workspace has an add-on, each of its permissions gets a row too, Off or On. A key keeps what it was made with, so an add-on added later needs a new key.
Copy it once#
The key is shown once, right after it’s made:
Store it as a secret on your server, such as CLOUDPDF_API_KEY, and give it to the SDK:
const cloudpdf = new CloudPDFClient({
token: process.env.CLOUDPDF_API_KEY,
});Every call also names the workspace, as tenantId. Copy it from Tenant ID on the Connect
your server card, at the top of the page. The key works only for that workspace.
When it leaks, or expires#
Revoke stops a key within a minute, for good. If a key ends up in a repository, a log or a browser, revoke it and make a new one.
A key also stops at its expiry date. The date turns orange a week before, so you can make the next key and switch your server over first. Revoked and expired keys are under Show revoked and expired keys.
Good to know#
- One key per place. A key each for production, staging and your scripts means you can revoke one without stopping the others.
- Give a key only what it needs. A server that only makes tokens for documents you uploaded in the dashboard needs Viewer tokens on, Inside documents at what its tokens give, and Documents and folders at None.