Skip to content

Personal Access Tokens

Personal Access Tokens (PATs) are user-bound credentials that let you authenticate Assumetr API calls from scripts, CI/CD pipelines, and local tooling without sharing your login session.

PATs vs. API Clients

PATs are owned by a specific user and inherit that user's permissions. API Clients are org-level machine principals with explicit scope grants. Use PATs for personal automation; use API Clients for shared service accounts.

Creating a PAT

  1. Go to Settings → Preferences in your Assumetr dashboard.
  2. Scroll to the Personal Access Tokens section.
  3. Click + New token.
  4. Enter a descriptive name (e.g. ci-pipeline, local-dev) and choose an expiry date.
  5. Click Create token.

Copy the token immediately. It is displayed only once and cannot be retrieved again. If you lose it, revoke and create a new one.

Expiry is mandatory

Assumetr does not allow permanent (non-expiring) tokens. The maximum lifetime is 365 days. Plan for rotation.

Using a PAT

Include the token as a Bearer token in the Authorization header:

bash
curl https://api.assumetr.com/v1/user/pats \
  -H "Authorization: Bearer pat_a1b2c3d4..."

PATs are accepted on any Assumetr API endpoint that supports bearer authentication. The request runs with your user's current permissions.

Token Format

PartExampleDescription
Prefixpat_Identifies the credential class
Bodya1b2c3d4... (64 hex chars)Cryptographically random
Display prefixpat_a1b2c3Shown in the token list (first 8 chars)

The full token is 68 characters long. Store it as you would a password — in a secret manager, CI/CD secret variable, or .env file excluded from version control.

Revoking a PAT

  1. Go to Settings → Preferences.
  2. In the Personal Access Tokens section, find the token you want to revoke.
  3. Click Revoke and confirm.

Revocation is immediate. Any automation using the token will receive 401 Unauthorized on the next request.

Token Lifecycle

StateConditionAPI response
ActiveNot revoked, not expiredRequests succeed
Expiredexpires_at has passed401 — re-create the token
RevokedManually revoked401 — create a new token

Security Recommendations

  • Use descriptive names. Include the system or purpose (ci-deploy, audit-export) so you know where a token is used.
  • Set the shortest practical expiry. A 30-day token for a one-off task is better than a 365-day token.
  • Rotate before expiry. Create the replacement token, update your secret manager, then revoke the old one.
  • Never commit tokens to version control. Use CI/CD secret variables or secret managers.
  • Review periodically. The token list in Preferences shows last-used dates — revoke anything unused.

API Reference

PATs are managed via three endpoints under /v1/user/pats. All require an active session token (Authorization: Bearer <session-jwt>) and a verified email address.

List PATs

GET /v1/user/pats

Returns all PATs for the current user. Plaintext tokens are never returned here.

Response 200:

json
{
  "pats": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "name": "ci-pipeline",
      "token_prefix": "pat_a1b2c3d4",
      "status": "active",
      "created_at": "2026-04-01T10:00:00Z",
      "expires_at": "2027-04-01T10:00:00Z",
      "last_used_at": "2026-04-20T09:00:00Z"
    }
  ]
}

Create a PAT

POST /v1/user/pats
Content-Type: application/json

Request body:

json
{
  "name": "ci-pipeline",
  "expires_at": "2027-04-01T10:00:00Z"
}
FieldTypeRequiredConstraints
namestring1–128 characters
expires_atRFC 3339 datetimeMust be in the future; max 365 days from now

Response 201:

json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "token": "pat_a1b2c3d4...",
  "token_prefix": "pat_a1b2c3d4",
  "name": "ci-pipeline",
  "created_at": "2026-04-01T10:00:00Z",
  "expires_at": "2027-04-01T10:00:00Z"
}

WARNING

token is returned only once. Store it immediately.

Error codes:

StatusCodeCause
400validation_errorMissing or invalid name / expires_at (past date)
422expiry_too_farexpires_at exceeds 365 days

Revoke a PAT

DELETE /v1/user/pats/{patID}

Immediately revokes the token. Subsequent requests using the token receive 401.

Response 204: No content.

Error codes:

StatusCodeCause
404not_foundToken does not exist or belongs to a different org
403forbiddenToken belongs to a different user
409already_revokedToken was already revoked