# Get API token

> Source: https://truto.one/docs/api-reference/admin/api-tokens/get/

`GET /api-token/{id}`

Resource: **Api Tokens**

## Path parameters

- **`id`** _(string, required)_
  The ID of the token you want to retrieve.

## Query parameters

- **`environment_id`** _(string)_
  Filter tokens by environment ID (user should have access to the environment).
- **`name`** _(string)_
  Filter tokens by name.

## Response body

- **`id`** _(string)_
  The ID of the API token.
- **`name`** _(string)_
  A descriptive name for the token.
- **`created_by`** _(string)_
  The ID of the user who created this token.
- **`environment_id`** _(string)_
  The ID of the environment this token is scoped to.
- **`created_at`** _(string)_
  The date and time when the token was created.
- **`updated_at`** _(string)_
  The date and time when the token was last updated.

## Code examples

### curl

```bash
curl -X GET 'https://api.truto.one/api-token/{id}' \
  -H 'Authorization: Bearer <your_api_token>' \
  -H 'Content-Type: application/json'
```

### JavaScript

```javascript
const response = await fetch('https://api.truto.one/api-token/{id}', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer <your_api_token>',
    'Content-Type': 'application/json',
  },
});

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

### Python

```python
import requests

url = "https://api.truto.one/api-token/{id}"
headers = {
    "Authorization": "Bearer <your_api_token>",
    "Content-Type": "application/json",
}
params = {
}

response = requests.get(url, headers=headers, params=params)
print(response.json())
```

### Truto TS SDK

```typescript
import Truto from '@truto/truto-ts-sdk';

const truto = new Truto({
  token: '<your_api_token>',
});

const result = await truto.apiToken.get('<id>');

console.log(result);
```

### Truto Python SDK

```python
import asyncio
from truto_python_sdk import TrutoApi

truto_api = TrutoApi(token="<your_api_token>")

async def main():
    result = await truto_api.api_tokens.get("<id>")
    print(result)

asyncio.run(main())
```
