GET /users/<sid>/tokens

Fetches a list of tokens for a given user. Authentication required.

Request format

When Forming RBAC API requests to this endpoint, you must supply a user ID in the URI path, such as:

https://$(puppet config print server):4433/rbac-api/v1/users/c97c716a-5f42-49d8-b5a4-d0888a879d21/tokens

You can append these optional parameters to the request:

Parameter Definition
limit An integer specifying the maximum number of records to return. If omitted, all records are returned.
offset Specify a zero-indexed integer to specify the index value of the first record to return. If omitted, the default is position 0 (the first record). For example, offset=5 would start from the 6th record.
order_by Specify one of the following strings to define the order in which records are returned:
  • creation_date
  • expiration_date
  • last_active_date
  • client
If omitted, the default is creation_date.
order Determines the sort order as either ascending (asc) or descending (desc). If omitted, the default is asc.

For example:

curl "https://$(puppet config print server):4433/rbac-api/v1/users/<SID>/tokens?limit=20" \
-H "X-Authentication:$(puppet-access show)"

Response format

The response is a JSON object describing each token and the pagination information from the request.

Tokens are containing in an items array. Each token is represented as an object using these keys:

  • id: The token's ID
  • creation_date: The date and time the token was created in ISO-8601 format.
  • expiration_date: The date and time the token expires (or expired) in ISO-8601 format.
  • last_active_date: The date and time the token was last used in ISO-8601 format.
  • client: Client information.
  • description: Arbitrary description information.
  • session_timeout: An integer, present with a timeout (in minutes), if this is a session-based token.
  • label: A label, if one was supplied at creation. Refer to Set a token-specific label.

The pagination object reiterates the query pameters from the request as well as the total number of records available (regardless of limit or offset).

For example:

{"items": [{
      "id": <token_id>
      "creation_date": <ISO-8601>,
      "expiration_date":  <ISO-8601>,
      "last_active_date": <ISO-8601>,
      "client":  "",
      "description": "",
      "session_timeout": ,
      "label": ""
   }, ... 
 ],
 "pagination": {
      "limit": 20,
      "offset": 0,
      "order_by": "creation_date",
      "order": "asc"
      "total": 25
   }
}

Error response

If a user with the provided use ID doesn't exist, the endpoint returns a 404 Not Found response.

For other errors, refer to RBAC service errors .