1. Docs
  2. Pulumi Cloud
  3. Pulumi Cloud REST API
  4. Personal Access Tokens

Personal Access Tokens

    Personal Access Tokens (PATs) are credentials that can be used to authenticate with the Pulumi Cloud API instead of using interactive login flows. The Personal Access Tokens API allows you to manage these tokens programmatically.

    Token Operations

    The API provides endpoints for the following operations:

    • Listing your personal access tokens
    • Creating new personal access tokens
    • Deleting personal access tokens

    List Personal Access Tokens

    GET /api/user/tokens
    

    Parameters

    ParameterTypeInDescription
    show_expiredstringqueryOptional. whether to return previously expired tokens with results. Defaults to false.

    Example

    curl \
      -H "Accept: application/vnd.pulumi+8" \
      -H "Content-Type: application/json" \
      -H "Authorization: token $PULUMI_ACCESS_TOKEN" \
      https://api.pulumi.com/api/user/tokens?show_expired=true
    

    Default response

    Status: 200 OK
    
    {
      "tokens": [
        {
          "id": "b02514e2-ddf6-41dc-8e16-6abf3914e68f",
          "description": "Generated by pulumi login on workstation at 20 May 21 12:04 EDT",
          "lastUsed": 1627590233
        },
        {
          "id": "ad9f7508-493a-4fbe-9918-62f1f71a53f8",
          "description": "cicd-server",
          "lastUsed": 1606860942
        }
      ]
    }
    

    Create Personal Access Token

    POST /api/user/tokens
    

    Parameters

    ParameterTypeInDescription
    descriptionstringbodyDescription of the access token.
    expiresintbodyOptional. unix epoch timestamp at which the token should expire, up to two years from present. 0 for no expiry. Defaults to 0.

    Example

    curl \
      -H "Accept: application/vnd.pulumi+8" \
      -H "Content-Type: application/json" \
      -H "Authorization: token $PULUMI_ACCESS_TOKEN" \
      --request POST \
      --data '{"description":"{description}", "expires": 0}' \
      https://api.pulumi.com/api/user/tokens
    

    Default response

    Status: 204 OK
    
    {
      "id": "74529ccd-27c0-40f7-bc4a-589f145ba67f",
      "tokenValue": "pul-75a564ac7f3a48079a0c448c1e1ec95c4cfed141"
    }
    

    Delete Personal Access Token

    DELETE /api/user/tokens/{tokenId}
    

    Parameters

    ParameterTypeInDescription
    tokenIdstringpaththe token identifier

    Example

    curl \
      -H "Accept: application/vnd.pulumi+8" \
      -H "Content-Type: application/json" \
      -H "Authorization: token $PULUMI_ACCESS_TOKEN" \
      --request DELETE \
      https://api.pulumi.com/api/user/tokens/{tokenId}
    

    Default response

    Status: 204 OK
    
    EMPTY RESPONSE BODY