# ALTER API\_TOKEN

## Syntax <a href="#synopsis" id="synopsis"></a>

```sql
ALTER API_TOKEN api_token_name RENEW TOKEN;
```

## Description <a href="#description" id="description"></a>

Modify an existing `API_TOKEN` for a [Access Control](/overview/core-concepts/access-control.md#user) in the current [Access Control](/overview/core-concepts/access-control.md#organiation).

### Arguments

#### api\_token\_name

This specifies the name of the `API_TOKEN` to modify.

## Examples <a href="#example" id="example"></a>

#### Refresh an existing API\_TOKEN

This example shows an existing API token `my_token` getting renewed:

```shell
<no-db>/<no-store># LIST API_TOKENS;
+----------+-------------------------------+-------------------------------+-------------------------------+
|  Name    |  Last Used                    |  Created At                   |  Expires At                   |
+==========+===============================+===============================+===============================+
| my_token | 2024-07-11 20:38:32 +0000 UTC | 2024-07-11 20:37:17 +0000 UTC | 2024-10-09 20:37:17 +0000 UTC |
+----------+-------------------------------+-------------------------------+-------------------------------+
<no-db>/<no-store># ALTER API_TOKEN my_token RENEW TOKEN;
+-----------+----------+----------+------------------------------------------+--------------------------------+
|  Type     |  Name    |  Command |  Summary                                 |  Token                         |
+===========+==========+==========+==========================================+================================+
| api_token | my_token | ALTER    | api_token my_token was successfully      | <redacted_refreshed_api_token> |
|           |          |          | refreshed                                |                                |
+-----------+----------+----------+------------------------------------------+--------------------------------+
```

Note how the creation and expiration time of the API token changes and last used time resets after the `ALTER` statement successfully executes:

```bash
<no-db>/<no-store># LIST API_TOKENS;
+----------+------------+-------------------------------+-------------------------------+
|  Name    |  Last Used |  Created At                   |  Expires At                   |
+==========+============+===============================+===============================+
| my_token | <null>     | 2024-07-11 20:38:50 +0000 UTC | 2024-10-09 20:38:50 +0000 UTC |
+----------+------------+-------------------------------+-------------------------------+
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.deltastream.io/reference/sql-syntax/ddl/alter-api_token.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
