Skip to Content
Users Personal Access Tokens

Rotate a specific personal access token.

POST
/users/personal-access-tokens/{personal_access_token_id}/rotate

Path Parameters

personal_access_token_id*string

The ID of the personal access token.

Header Parameters

Accept*string

application/json

Authorization*string

Bearer {{access_token}}

Content-Type*string

application/json

Request Body

A JSON object containing the resource data

application/json
  1. body
id*string

The unique identifier of the token.

expires_at*string

The date and time when the token expires. Must be a valid date. Must be a date after now. Must be a date before now +1 year.

Response Body

Ok

application/json
  1. response
id*string

Unique identifier of the Token

name*string

Name of the Token

type*ApiTokenType

The types of API Tokens.

Value in"personal_access_token""project_api_token"
token*|

The plain text value of the Token. The API token value is only displayed/returned once when the token is generated. Users must keep it in a safe place, as it cannot be retrieved again at a later time.

status*ApiTokenStatus

The possible status of API tokens.

Value in"active""expired""revoked"
user*|null
last_used_at*|

Last time the Token was used

expires_at*string

Expiration date of the Token

revoked_at*|

Revocation date of the Token

updated_at*string

Last time the Token was updated

created_at*string

Creation date of the Token

Example Request
curl -X POST 'https://api.devopness.com/users/personal-access-tokens/2ab973e1-9528-4d67-aff0-209d74975830/rotate' \  -H 'Accept: application/json' \  -H 'Authorization: Bearer <your_api_token>' \  -H 'Content-Type: application/json' \  -H 'Content-Type: application/json' \  -d '{  "id": "c28f88fe-322e-477c-bfe9-982072805a01",  "expires_at": "2023-01-01T00:00:00Z"}'
Example Response
{  "id": "e70e75cb-7922-47d2-a071-54b7d7ede4be",  "name": "My Token",  "type": "personal_access_token",  "token": null,  "status": "active",  "user": {    "id": 1,    "name": "string",    "email": "user@example.com",    "url_slug": "someone",    "language": "en",    "active": true,    "created_at": "2019-09-25T15:50:48.000000Z",    "updated_at": "2019-09-25T13:52:04.000000Z"  },  "last_used_at": "2023-01-01T00:00:00Z",  "expires_at": "2023-12-31T23:59:59Z",  "revoked_at": null,  "updated_at": "2023-01-01T00:00:00Z",  "created_at": "2023-01-01T00:00:00Z"}