Skip to main content
Send a permission preset or explicit permissions to create a token limited to this project and any listed projectIds. Send the returned token in the X-Scoped-Token header. Tokens last at most six hours and cannot issue other tokens.

Signature

Method signature on client.projects:

Parameters

Pass one of the argument shapes shown in the signature.
string
required
Project ID with prefix pp..
"write" | "read" | "deploy" | "labeling-read" | "labeling-write" | "labeling-deploy"
A named permission set: read (Read everything), write (Read and write, no spending), deploy (Read, write and launch runs that spend money), labeling-read (Data labeling: read), labeling-write (Data labeling: read and write, no spending), labeling-deploy (Data labeling: read, write and launch pipelines).
string[]
Further projects the token may act in; the project in the path is always included. All projects must belong to the same team.
number
Token lifetime in seconds, from 60 to 21600; defaults to 21600.
string[]
Explicit resource:operation permissions.

Returns

Promise<ScopedToken>
string
required
Public handle of the token; use it to revoke without holding the secret.
string
required
The access token. Returned only when created; save it before closing the response.
string
required
When the token stops working.

Errors

HTTP errors throw PotatoApiError. The endpoint documents these error responses: HTTP endpoint: POST /projects/{projectId}/tokens.