admin

Create a personal access token

Creates a personal access token (pat_) for the signed-in user in their organization. Tokens are created from a signed-in session, never by another token. The requested scopes must exist and must be within the user's own permissions: a token can never carry more authority than the person who created it, and a request that asks for more is refused with each offending scope named rather than quietly narrowed. The token value is returned once and cannot be retrieved again.

post/tokens

Request

  • Base URL: https://api.letsship.ai/v1
  • URL: https://api.letsship.ai/v1/tokens
  • Auth: HTTP bearer

Request body

namestring required

Human label shown in the token list. Not an identifier.

scopesstring[]

Scopes to delegate to the token. Every entry must be a declared scope AND within the caller's own grant ceiling (a token can never carry authority its minter lacks) - otherwise 403, naming each refused entry. Defaults to none.

expiresInDaysinteger

Lifetime in days from now. Tokens always expire; there is no non-expiring option.

projectIdstring

Bind the token to ONE project. Missions, runs, environments, artifacts and scheduled tasks then refuse anything outside it - the narrowest useful grant for a third-party integration. The project records themselves stay readable across the org. The project must belong to your org, otherwise 404. Omitted: the token is org-wide.

Example request

{
  "name": "laptop CLI",
  "scopes": [
    "missions:run",
    "missions:read"
  ],
  "expiresInDays": 90,
  "projectId": "proj_f0e324d8a104d8e4ae9426e4"
}

Response

Token created. token is shown here and never again.

idstring required
namestring required
tokenstring required

The raw bearer token. Shown once, at creation, and never again.

scopesstring[] required
projectIdstring nullable required

The project this token is bound to, or null when it is org-wide.

expiresAtinteger required
createdAtinteger required

Example response

{
  "id": "tok-pat-9b8e2a3f",
  "name": "laptop CLI",
  "token": "pat_yYqk7Fp2R8x…",
  "scopes": [
    "missions:run"
  ],
  "expiresAt": 1743465600000,
  "createdAt": 1735689600000
}

Changes

No recorded changes to this operation across all 1 revision of this API.