Skip to Content
API reference

API tokens

Personal API tokens: mint, list and revoke.

List the caller's tokens

GET
/v1/tokens

Authorization

bearerAuth
headerAuthorizationBearer <token>

A personal API token (pl4m_pat_…). The owner is resolved from the credential, never claimed by the caller.

Query Parameters

owner_id?|null
limit?Limit
Range1 <= value <= 200
Default50
cursor?string|null
include_inactive?Include Inactive
Defaulttrue

Header Parameters

authorization?string|null

Response Body

Successful Response

application/json
  1. response

A page of the caller's tokens.

api_tokens*array<>
page*

Cursor pagination envelope metadata.

Example Request
curl -X GET 'https://app.pl4m.com/api/v1/tokens' \  -H 'Authorization: Bearer '
Example Response
{  "api_tokens": [    {      "active": true,      "created_at": "2019-08-24T14:15:22Z",      "expires_at": "2019-08-24T14:15:22Z",      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",      "last_used_at": "2019-08-24T14:15:22Z",      "name": "string",      "owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",      "prefix": "string",      "revoked_at": "2019-08-24T14:15:22Z",      "scopes": [        "artifacts:read"      ],      "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5"    }  ],  "page": {    "limit": 1,    "next_cursor": "string"  }}
POST
/v1/tokens

Authorization

bearerAuth
headerAuthorizationBearer <token>

A personal API token (pl4m_pat_…). The owner is resolved from the credential, never claimed by the caller.

Header Parameters

authorization?string|null

Request Body

application/json
  1. body

Mint a personal API token, scoped to one of the caller's owners.

A token is pinned to the owner it is minted for and can never act as another, so which owner is part of the credential rather than part of each call made with it.

expires_at?|null
name*Name
Length1 <= length <= 100
owner_id?|

Which of your owners to act as. Defaults to your personal owner. Checked against your memberships before use: an owner you do not belong to returns FORBIDDEN, and a personal API token may only act as the owner it was minted for.

scopes*array<>
Items1 <= items

Response Body

Successful Response

application/json
  1. response

Creation response — the only time the secret is returned.

api_token*

A personal API token, without the secret. The token itself is returned once, when it is created, and never again.

ok?Ok
Defaulttrue
token*Token

Shown once. Only its sha256 hash is stored; pl4m cannot show it again.

Length32 <= length
Example Request
curl -X POST 'https://app.pl4m.com/api/v1/tokens' \  -H 'Authorization: Bearer ' \  -H 'Content-Type: application/json' \  -d '{  "name": "string",  "scopes": [    "artifacts:read"  ]}'
Example Response
{  "api_token": {    "active": true,    "created_at": "2019-08-24T14:15:22Z",    "expires_at": "2019-08-24T14:15:22Z",    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "last_used_at": "2019-08-24T14:15:22Z",    "name": "string",    "owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",    "prefix": "string",    "revoked_at": "2019-08-24T14:15:22Z",    "scopes": [      "artifacts:read"    ],    "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5"  },  "ok": true,  "token": "stringstringstringstringstringst"}

Revoke a token

DELETE
/v1/tokens/{token_id}

Authorization

bearerAuth
headerAuthorizationBearer <token>

A personal API token (pl4m_pat_…). The owner is resolved from the credential, never claimed by the caller.

Path Parameters

token_id*Token Id
Formatuuid

Header Parameters

authorization?string|null

Response Body

Successful Response

application/json
  1. response

A delete / revoke that succeeded.

deleted_at*Deleted At
Formatdate-time
id*Id
Formatuuid
ok?Ok
Defaulttrue
Example Request
curl -X DELETE 'https://app.pl4m.com/api/v1/tokens/497f6eca-6276-4993-bfeb-53cbbbba6f08' \  -H 'Authorization: Bearer '
Example Response
{  "deleted_at": "2019-08-24T14:15:22Z",  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "ok": true}