Change what a token may do
const url = 'https://beta-api.plune.ai/v1/tokens/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0';const options = { method: 'PATCH', headers: { cookie: 'plune_session=<plune_session>', 'Content-Type': 'application/json' }, body: '{"scope":"write"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://beta-api.plune.ai/v1/tokens/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0 \ --header 'Content-Type: application/json' \ --cookie plune_session=<plune_session> \ --data '{ "scope": "write" }'Account → API tokens (api.ts → setTokenScope), #1283. {"scope": "read" | "write"}: the next request that carries the token is judged by the new scope, and the token is not reissued - the secret in a CI job stays the same. A change writes an api_token entry (before and after) to the audit log of the token’s project; saying the scope it already has writes none. Session-only on purpose: a token must not be able to widen itself.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”Request Body required
Section titled “Request Body required ”object
What a token may do (#1283). read answers GET, HEAD and OPTIONS (and POST /v1/test-cases/resolve, which only reads) and refuses every other request with 403 read-only token, each refusal written to the audit log as an api_token entry of action event (the token, the method and the path). write is everything its owner may do, and is what every token issued before this existed holds. Whatever its scope, a token that names a session in X-Plune-Session (an agent) is refused every DELETE with 403 agent_cannot_delete (#1280): a deletion is confirmed by a person. A token without the header, and a person with a session cookie, are not held.
Example
{ "scope": "write"}Responses
Section titled “ Responses ”The token as the list shows it
object
What a token may do (#1283). read answers GET, HEAD and OPTIONS (and POST /v1/test-cases/resolve, which only reads) and refuses every other request with 403 read-only token, each refusal written to the audit log as an api_token entry of action event (the token, the method and the path). write is everything its owner may do, and is what every token issued before this existed holds. Whatever its scope, a token that names a session in X-Plune-Session (an agent) is refused every DELETE with 403 agent_cannot_delete (#1280): a deletion is confirmed by a person. A token without the header, and a person with a session cookie, are not held.
When the token stops working on its own. null for tokens issued before expiry existed (#258); new ones get 90 days.
The project it writes to. null — every token from before B8-team — means the owner’s default project.
Example
{ "scope": "read"}A scope that is neither read nor write
object
Example generated
{ "error": "example"}No / invalid session
Not your token, or no longer live (existence is never revealed)
object
Example generated
{ "error": "example"}Rate-limited: the per-route throttle, or the per-minute request limit of the plan an API token counts by (#1442; the body names the plan, #2092). Retry-After carries the seconds until the window rolls over.
object
Example generated
{ "error": "example"}Headers
Section titled “Headers ”Seconds until the window rolls over