> This page is for API.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.eon.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.eon.io/_mcp/server.

# Get Access Token

POST https://%7Baccount-domain%7D.console.eon.io/api/v1/token
Content-Type: application/json

Retrieves an access token, which you then pass in the `Authorization` header when calling API methods.

The client ID and secret you provide when calling this method must be from a set of API credentials from your Eon account.
To learn more about creating API credentials and completing the authentication flow, see [Authentication](/api/using-the-api/authentication).

The returned access token has the permissions included in the role you assigned to the API credentials.
Always make sure the API credentials have the permissions needed for the API methods you want to use it for.

The access token is valid for 12 hours.
After that, you must call this method again to get a new token.


Reference: https://docs.eon.io/api/api-reference/auth/get-access-token

## Request

### Body (application/json)

This endpoint expects an ApiCredentials.

- `clientId` (string, required) — API client ID.
- `clientSecret` (string, required) — API client secret.

## Response

### 200

Authenticated

- `accessToken` (string, optional) — Access token, which you pass in the `Authorization` header when calling API methods.
- `expirationSeconds` (integer, optional) — Length of time until the token expires, in seconds. Default: `43200` (12 hours).

## Errors

### 404 Not Found Error

API credentials not found.

- `error` (string, optional)

## Examples

**Request**

```json
{
  "clientId": "yaeiq73af5cbxibLiu22yw2t5ezeozxu5itv43uw2tyn3xpqprta",
  "clientSecret": "eon_sample620a571c00caf772b8e1b69de703792ba12c9eadef689725e0489324a093a64b4459ffecbaaa441c377950628b6b9042af728056d1d060b8f5d5sample"
}
```

**Response**

```json
{
  "accessToken": "string",
  "expirationSeconds": 43200
}
```

**SDK Code**

```python
import requests

url = "https://{account-domain}.console.eon.io/api/v1/token"

payload = {
    "clientId": "yaeiq73af5cbxibLiu22yw2t5ezeozxu5itv43uw2tyn3xpqprta",
    "clientSecret": "eon_sample620a571c00caf772b8e1b69de703792ba12c9eadef689725e0489324a093a64b4459ffecbaaa441c377950628b6b9042af728056d1d060b8f5d5sample"
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://{account-domain}.console.eon.io/api/v1/token';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"clientId":"yaeiq73af5cbxibLiu22yw2t5ezeozxu5itv43uw2tyn3xpqprta","clientSecret":"eon_sample620a571c00caf772b8e1b69de703792ba12c9eadef689725e0489324a093a64b4459ffecbaaa441c377950628b6b9042af728056d1d060b8f5d5sample"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://{account-domain}.console.eon.io/api/v1/token")
  .header("Content-Type", "application/json")
  .body("{\n  \"clientId\": \"yaeiq73af5cbxibLiu22yw2t5ezeozxu5itv43uw2tyn3xpqprta\",\n  \"clientSecret\": \"eon_sample620a571c00caf772b8e1b69de703792ba12c9eadef689725e0489324a093a64b4459ffecbaaa441c377950628b6b9042af728056d1d060b8f5d5sample\"\n}")
  .asString();
```