# Rename API token

> Source: https://elaichi.ai/docs/api-reference/api-tokens/api-token/patchapitoken/

`PATCH /api-token/{id}`

Resource: **Api Token** · API: **API tokens**

## Path parameters

- **`id`** _(string, required)_
  API token id (`atok_…`) — not the token itself.

## Request body

- **`name`** _(string)_
  New display name.

## Response body

- **`id`** _(string)_
  API token id (`atok_…`).
- **`organization_id`** _(string)_
  The single organization this token can address (`org_…`).
- **`user_id`** _(string)_
  Member (`usr_…`) the token acts as. It carries that member's permissions, live.
- **`name`** _(string)_
- **`last_used_at`** _(string,null)_
- **`created_at`** _(string)_
- **`updated_at`** _(string)_

## Code examples

### curl

```bash
curl -X PATCH 'https://api.elaichi.ai/api-token/<id>' \
  -H 'Authorization: Bearer $ELAICHI_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"name":"your_name"}'
```

### JavaScript

```javascript
const body = {
  "name": "your_name"
};

const response = await fetch('https://api.elaichi.ai/api-token/<id>', {
  method: 'PATCH',
  headers: {
    'Authorization': 'Bearer ' + process.env.ELAICHI_API_TOKEN,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(body),
});

const data = await response.json();
console.log(data);
```

### Python

```python
import os
import requests

url = "https://api.elaichi.ai/api-token/<id>"
headers = {
    "Authorization": f"Bearer {os.environ['ELAICHI_API_TOKEN']}",
    "Content-Type": "application/json",
}
payload = {
    "name": "your_name"
}

response = requests.patch(url, headers=headers, json=payload)
print(response.json())
```
