# Update Token

Launch stage: GA

`PATCH /api/2.0/token-management/tokens/{token.token_id}`

Updates a token, specified by its ID.

API scopes: authentication

## Path parameters

- `token` (object, optional)
  - `token_id` (string, optional)
    ID of the token.
    Example: `5684c955822ac792a51ae2aeb80190f13457bab3e2e2934c133a08b38454816c`
  - `creation_time` (int64, optional)
    Timestamp when the token was created.
    Example: `1580265020299`
  - `expiry_time` (int64, optional)
    Timestamp when the token expires.
    Example: `1580265020299`
  - `comment` (string, optional)
    Comment that describes the purpose of the token, specified by the token creator.
    Example: `This is for the ABC department automation scripts.`
  - `created_by_id` (int64, optional)
    User ID of the user that created the token.
    Example: `202480738464078`
  - `created_by_username` (string, optional)
    Username of the user that created the token.
    Example: `jsmith@example.com`
  - `owner_id` (int64, optional)
    User ID of the user that owns the token.
    Example: `202480738464078`
  - `workspace_id` (int64, optional)
    If applicable, the ID of the workspace that the token was created in.
    Example: `5750939285643220`
  - `last_used_day` (int64, optional)
    Approximate timestamp for the day the token was last used. Accurate up to 1 day.
    Example: `1710374400000`
  - `scopes` (array of string, optional)
    Scope of the token was created with, if applicable.

## Request body

- `update_mask` (string, optional)
  A list of field name under token, For example, {"update_mask": "comment,scopes"}

## Returns

- `token_id` (string, optional)
  ID of the token.
  Example: `5684c955822ac792a51ae2aeb80190f13457bab3e2e2934c133a08b38454816c`
- `creation_time` (int64, optional)
  Timestamp when the token was created.
  Example: `1580265020299`
- `expiry_time` (int64, optional)
  Timestamp when the token expires.
  Example: `1580265020299`
- `comment` (string, optional)
  Comment that describes the purpose of the token, specified by the token creator.
  Example: `This is for the ABC department automation scripts.`
- `created_by_id` (int64, optional)
  User ID of the user that created the token.
  Example: `202480738464078`
- `created_by_username` (string, optional)
  Username of the user that created the token.
  Example: `jsmith@example.com`
- `owner_id` (int64, optional)
  User ID of the user that owns the token.
  Example: `202480738464078`
- `workspace_id` (int64, optional)
  If applicable, the ID of the workspace that the token was created in.
  Example: `5750939285643220`
- `last_used_day` (int64, optional)
  Approximate timestamp for the day the token was last used. Accurate up to 1 day.
  Example: `1710374400000`
- `scopes` (array of string, optional)
  Scope of the token was created with, if applicable.

## Response

```json
{
  "token_id": "5684c955822ac792a51ae2aeb80190f13457bab3e2e2934c133a08b38454816c",
  "creation_time": 1580265020299,
  "expiry_time": 1580265020299,
  "comment": "This is for the ABC department automation scripts.",
  "created_by_id": 202480738464078,
  "created_by_username": "jsmith@example.com",
  "owner_id": 202480738464078,
  "workspace_id": 5750939285643220,
  "last_used_day": 1710374400000,
  "scopes": [
    "string"
  ]
}
```

