Skip to main content
Pulumi logo Pulumi logo
  1. Docs
  2. Reference
  3. REST API Docs
  4. Access Tokens

Access Tokens

    Access Tokens are credentials used to authenticate with the Pulumi Cloud API. The Access Tokens API covers both personal access tokens (PATs) for individual users and organization-level tokens for team use.

    List Service Principal Tokens

    ▼
    Preview. This endpoint is in preview and may change without notice.
    GET /api/orgs/{orgName}/service-principals/{userLogin}/tokens

    Lists the access tokens of a user-defined service principal, named by its login or ID. Token values are never returned after creation.

    By default only active tokens are listed; set filter to expired or all to include others, and search to match a token’s name or description, or a prefix of its ID. Without maxResults or continuationToken, all matching tokens are returned in one response. To page through them, pass maxResults, then pass the continuationToken of each response to fetch the next page. Tokens are listed newest first by creation time unless sortBy and sortDirection say otherwise. Requires the org_token:read permission.

    Returns 409 when service principals are not enabled for the organization.

    Request Parameters

    • orgName string path required
      The organization name
    • userLogin string path required
      The service principal’s login (service-principal:<ID>), or its ID
    • continuationToken string query optional
      Opaque token for fetching the next page of results.
    • filter string query optional
      Filter tokens by status (active, expired, or all). Defaults to active.
    • maxResults integer query optional
      Maximum number of tokens per page, from 1 to 1000. Without it, all matching tokens are returned in one response, or 100 per page when a continuationToken is passed.
    • search string query optional
      Case-insensitive substring match on token name or description, or a prefix of the token ID
    • sortBy string query optional
      Field to sort the results by. Defaults to created.
    • sortDirection string query optional
      Direction to sort the results in. Defaults to desc.

    Responses

    200 OK
    • tokens array[AccessToken] required
      The list of access tokens
    • ↳ id string required
      Unique identifier for this access token.
    • ↳ name string required
      Human-readable name assigned to this access token.
    • ↳ description string required
      User-provided description of the token’s purpose.
    • ↳ created string required
      Timestamp when the token was created, in ISO 8601 format.
    • ↳ lastUsed integer required
      Unix epoch timestamp (seconds) when the token was last used. Zero if never used.
    • ↳ expires integer required
      Unix epoch timestamp (seconds) when the token expires. Zero if it never expires.
    • ↳ admin boolean required
      Whether this token has Pulumi Cloud admin privileges.
    • ↳ createdBy string required
      User.GitHubLogin of the user that created the access token
    • ↳ role AccessTokenRole optional
      Role associated with the token, if applicable
    • ↳ type enum optional
      The token’s kind.
      Values:
      personal — Personal
      A personal access token created by a user.
      refresh — Refresh
      A refresh token, exchanged for short-lived OBO access tokens at /api/oauth/token. Not authorized for any other endpoint.
      organization — Organization
      A machine token bound to an organization’s robot user.
      team — Team
      A machine token bound to a team’s robot user within an organization.
      service-principal — ServicePrincipal
      A machine token that authenticates as a user-defined service principal of an organization.
    • continuationToken string optional
      ContinuationToken can be used to fetch the next page of results. If null, there are no more results available.
    Errors: 400 Invalid continuationToken or maxResults value 403 The caller lacks the org_token:read permission 404 Service principal not found 409 Service principals are not enabled for the organization

    Create Service Principal Token

    ▼
    Preview. This endpoint is in preview and may change without notice.
    POST /api/orgs/{orgName}/service-principals/{userLogin}/tokens

    Creates an access token that authenticates as a user-defined service principal, named by its login or ID. Requests made with the token act as the service principal, with exactly its organization-wide roles and entity access, and audit logs attribute them to it.

    Service principal tokens require a plan with teams and machine tokens. The request returns 402 on a plan without teams. It returns 403 when the organization has no subscription, its subscription is canceled or its trial has expired, its plan has no machine tokens, or service principal tokens are not enabled for it. It returns 409 when service principals are not enabled for the organization.

    The name field must be unique among the service principal’s tokens (including deleted tokens) and cannot exceed 40 characters; the description may be empty and cannot exceed 255 characters. The optional expires field is a time in the future, at most two years from now. Without it the token does not expire, unless the organization sets a maximum token lifetime: then expires is required and must fall within that limit.

    Requires the org_token:create permission. Delegated credentials, such as Neo agent tokens and tokens obtained through OIDC token exchange, cannot create tokens, so that a token cannot be used to mint further long-lived tokens.

    Important: The token value in the response is only returned once at creation time and cannot be retrieved later.

    Request Parameters

    • orgName string path required
      The organization name
    • userLogin string path required
      The service principal’s login (service-principal:<ID>), or its ID

    Request Body

    • name string required
      The name of the token, unique among the service principal’s tokens, including deleted ones. At most 40 characters.
    • description string required
      What the token is for. May be empty; at most 255 characters.
    • expires string optional
      When the token expires: a time in the future, at most two years from now. Without it, the token does not expire, unless the organization sets a maximum token lifetime: then it is required and must fall within that limit.

    Responses

    200 OK
    • id string required
      The unique identifier
    • tokenValue string required
      The token value
    Errors: 400 Invalid name, description or expiry, or an expiry outside the organization's maximum token lifetime 402 The organization's plan does not include teams 403 The caller lacks the org_token:create permission or authenticated with delegated credentials; the organization has no subscription, a canceled subscription or an expired trial, or a plan without machine tokens; or service principal tokens are not enabled for the organization 404 Service principal not found 409 A token with this name already exists, or service principals are not enabled for the organization

    Delete Service Principal Token

    ▼
    Preview. This endpoint is in preview and may change without notice.
    DELETE /api/orgs/{orgName}/service-principals/{userLogin}/tokens/{tokenId}

    Permanently revokes and deletes an access token of a user-defined service principal, named by its login or ID. Automation using the token loses access immediately. Deleting the service principal itself, with DeleteOrganizationMember, deletes all its tokens.

    Requires the org_token:delete permission. Delegated credentials, such as Neo agent tokens and tokens obtained through OIDC token exchange, cannot delete tokens.

    Returns 409 when service principals are not enabled for the organization.

    Request Parameters

    • orgName string path required
      The organization name
    • userLogin string path required
      The service principal’s login (service-principal:<ID>), or its ID
    • tokenId string path required
      The ID of the token to delete

    Responses

    204 No Content
    Errors: 403 The caller lacks the org_token:delete permission or authenticated with delegated credentials 404 Service principal or token not found 409 Service principals are not enabled for the organization

    List Org Tokens

    ▼
    GET /api/orgs/{orgName}/tokens

    Retrieves the access tokens created for an organization. Organization tokens provide CI/CD automation access scoped to the organization rather than tied to individual user accounts. The response includes token metadata such as name, description, creation date, last used date, and expiration status. The actual token values are never returned after initial creation. Use the filter query parameter to narrow by status (active, expired, all). Use the search query parameter to match token name, description, ID, or creator login. Results are paginated; use continuationToken (returned in the response) and maxResults to page. Use the sortBy and sortDirection query parameters to order results; the default is newest-first by creation time.

    Request Parameters

    • orgName string path required
      The organization name
    • continuationToken string query optional
      Opaque token for fetching the next page of results.
    • filter string query optional
      Filter tokens by status (active, expired, or all). Defaults to active.
    • maxResults integer query optional
      Maximum number of tokens per page. Defaults to 100, maximum 1000.
    • search string query optional
      Case-insensitive substring match on token name, description, ID, or creator login
    • sortBy string query optional
      Field to sort the results by. Defaults to created.
    • sortDirection string query optional
      Direction to sort the results in. Defaults to desc.

    Responses

    200 OK
    • tokens array[AccessToken] required
      The list of access tokens
    • ↳ id string required
      Unique identifier for this access token.
    • ↳ name string required
      Human-readable name assigned to this access token.
    • ↳ description string required
      User-provided description of the token’s purpose.
    • ↳ created string required
      Timestamp when the token was created, in ISO 8601 format.
    • ↳ lastUsed integer required
      Unix epoch timestamp (seconds) when the token was last used. Zero if never used.
    • ↳ expires integer required
      Unix epoch timestamp (seconds) when the token expires. Zero if it never expires.
    • ↳ admin boolean required
      Whether this token has Pulumi Cloud admin privileges.
    • ↳ createdBy string required
      User.GitHubLogin of the user that created the access token
    • ↳ role AccessTokenRole optional
      Role associated with the token, if applicable
    • ↳ type enum optional
      The token’s kind.
      Values:
      personal — Personal
      A personal access token created by a user.
      refresh — Refresh
      A refresh token, exchanged for short-lived OBO access tokens at /api/oauth/token. Not authorized for any other endpoint.
      organization — Organization
      A machine token bound to an organization’s robot user.
      team — Team
      A machine token bound to a team’s robot user within an organization.
      service-principal — ServicePrincipal
      A machine token that authenticates as a user-defined service principal of an organization.
    • continuationToken string optional
      ContinuationToken can be used to fetch the next page of results. If null, there are no more results available.
    Errors: 400 Invalid continuationToken or maxResults value.

    Create Org Token

    ▼
    POST /api/orgs/{orgName}/tokens

    Generates a new access token scoped to the organization for use in CI/CD pipelines and automated workflows. Organization tokens belong to the organization rather than individual users, ensuring that access is not disrupted when team members leave.

    The name field must be unique across the organization (including deleted tokens) and cannot exceed 40 characters. The expires field accepts a unix epoch timestamp up to two years from the present, or 0 for no expiry (default).

    Important: The token value in the response is only returned once at creation time and cannot be retrieved later. Audit logs for actions performed with organization tokens are attributed to the organization rather than an individual user.

    This request must be authenticated as a user, for example with a personal access token. Organization and team access tokens cannot create organization tokens, even when they have the Admin role, so that a token cannot be used to mint further organization tokens. Such requests return a 403 error.

    Request Parameters

    • orgName string path required
      The organization name
    • reason string query optional
      Audit log reason for creating this token

    Request Body

    • description string required
      The description
    • name string required
      The display name of the token. Must be between 1 and 40 characters.
    • admin boolean required
      Whether the entity has admin privileges
    • expires integer required
      The expiration time
    • roleID string optional
      The role identifier

    Responses

    200 OK
    • id string required
      The unique identifier
    • tokenValue string required
      The token value
    Errors: 403 Forbidden. The request was authenticated with an organization or team access token rather than as a user, the caller lacks permission to create organization tokens, or the organization's plan does not include organization tokens.

    Delete Org Token

    ▼
    DELETE /api/orgs/{orgName}/tokens/{tokenId}

    Permanently revokes and deletes an organization access token. Any CI/CD pipelines or automation using this token will immediately lose access to the organization’s resources. This action cannot be undone.

    This request must be authenticated as a user, for example with a personal access token. Organization and team access tokens cannot delete organization tokens and receive a 403 error.

    Request Parameters

    • orgName string path required
      The organization name
    • tokenId string path required
      The access token identifier

    Responses

    204 No Content
    Errors: 403 Forbidden. The request was authenticated with an organization or team access token rather than as a user, or the caller lacks permission to delete organization tokens.

    List Personal Tokens

    ▼
    GET /api/user/tokens

    Returns the access tokens currently bound to the authenticated user: personal access tokens (Bearer-usable) and refresh tokens issued during agent signup (exchange-only at POST /api/oauth/token; 401 if presented as Bearer). Web-session tokens are excluded. Use the filter query parameter to narrow by status (active, expired, all). Use the search query parameter to match token name or description, or to prefix-match token ID. Results are paginated; use continuationToken (returned in the response) and maxResults to page. Revoke any entry via DELETE /api/user/tokens/{tokenId}, which is type-agnostic. Use the sortBy and sortDirection query parameters to order results; the default is newest-first by creation time.

    Request Parameters

    • continuationToken string query optional
      Opaque token for fetching the next page of results.
    • filter string query optional
      Filter tokens by status (active, expired, or all). Defaults to active.
    • maxResults integer query optional
      Maximum number of tokens per page. Defaults to 100, maximum 1000.
    • search string query optional
      Case-insensitive substring match on token name or description, or prefix match on token ID
    • sortBy string query optional
      Field to sort the results by. Defaults to created.
    • sortDirection string query optional
      Direction to sort the results in. Defaults to desc.

    Responses

    200 OK
    • tokens array[AccessToken] required
      The list of access tokens
    • ↳ id string required
      Unique identifier for this access token.
    • ↳ name string required
      Human-readable name assigned to this access token.
    • ↳ description string required
      User-provided description of the token’s purpose.
    • ↳ created string required
      Timestamp when the token was created, in ISO 8601 format.
    • ↳ lastUsed integer required
      Unix epoch timestamp (seconds) when the token was last used. Zero if never used.
    • ↳ expires integer required
      Unix epoch timestamp (seconds) when the token expires. Zero if it never expires.
    • ↳ admin boolean required
      Whether this token has Pulumi Cloud admin privileges.
    • ↳ createdBy string required
      User.GitHubLogin of the user that created the access token
    • ↳ role AccessTokenRole optional
      Role associated with the token, if applicable
    • ↳ type enum optional
      The token’s kind.
      Values:
      personal — Personal
      A personal access token created by a user.
      refresh — Refresh
      A refresh token, exchanged for short-lived OBO access tokens at /api/oauth/token. Not authorized for any other endpoint.
      organization — Organization
      A machine token bound to an organization’s robot user.
      team — Team
      A machine token bound to a team’s robot user within an organization.
      service-principal — ServicePrincipal
      A machine token that authenticates as a user-defined service principal of an organization.
    • continuationToken string optional
      ContinuationToken can be used to fetch the next page of results. If null, there are no more results available.
    Errors: 400 Invalid continuationToken or maxResults value.

    Create Personal Token

    ▼
    POST /api/user/tokens

    Creates a new personal access token for the authenticated user. The request body includes a description for the token and an optional expiration time. The response includes the token ID and the tokenValue (prefixed with ‘pul-’). The token value is only returned once at creation time and cannot be retrieved later.

    Request Parameters

    • reason string query optional
      Tracks the context that triggered token creation (e.g., redirect URL or referral source)

    Request Body

    • description string required
      The description
    • expires integer required
      The expiration time

    Responses

    200 OK
    • id string required
      The unique identifier
    • tokenValue string required
      The token value

    Delete Personal Token

    ▼
    DELETE /api/user/tokens/{tokenId}

    Permanently deletes a personal access token by its identifier. The token is immediately invalidated and can no longer be used for authentication. Returns 204 on success or 404 if the token does not exist.

    Request Parameters

    • tokenId string path required
      The access token identifier

    Responses

    204 No Content
    Errors: 404 Token

      The infrastructure platform for humans and agents.