> 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.

# Authentication

Eon API methods are secured and require an access token for every request.
Without a valid access token, your API calls fail.
This ensures that only authorized actors can interact with your resources.

## Authenticate API calls

#### Before you start

* Before you can authenticate, you need to [create API credentials][create-api-credentials]—meaning, API client ID and secret—in the Eon console.
  API credentials allow you or external apps to interact with the Eon API without sharing your login details.

  > **Warning**
  >
  > Your client secret is displayed only when you create or rotate your API credentials.
  > It can't be retrieved later.
  >
  > Make sure to store your client secret securely.
  > If you lose your secret or it becomes compromised, you'll need to create a fresh set of API credentials and update your client ID and secret everywhere they're used.

* Make sure there's a role that has the exact permissions you want to grant to the credentials.
  If there isn't one, you can [create a custom role][manage-custom-roles].

[create-api-credentials]: /data-protection/account-administration/access-management/api-credentials/manage-api-credentials

[manage-custom-roles]: /data-protection/account-administration/access-management/roles-and-permissions/manage-custom-roles

### Get an access token

Use the client ID and secret to authenticate with the Eon API and [get an access token][get-access-token].

[get-access-token]: /api/api-reference/auth/get-access-token

**`Example request: Get an access token`**

```bash title="Example request: Get an access token" {4-5}
curl -L 'https://{your_eon_subdomain}/api/v1/token' \
-H 'Accept: application/json' \
-d '{
  "clientId": "yaeiq7...6xwyxa7k2a",
  "clientSecret": "eon_98acb36d8e029e...b815131d935055e8af761ff5d1534605486b588"
}'
```

**`Response`**

```json title="Response" {2}
{
  "accessToken": "eyJraWQiOiJFOD...0y07s8upSDwyJX6TE8JZ73oX4rOpnjaOQ",
  "expirationSeconds": 43200
}
```

### Call an API method with your access token

Call any API method, making sure you provide the access token in the `Authorization` header.

**`Example request: Get daily storage summaries`**

```bash title="Example request: Get daily storage summaries" {3}
curl -L 'https://{your_eon_subdomain}/api/v1/projects/:projectId/dashboard/daily-storage-summary' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer eyJraWQiOiJFOD...0y07s8upSDwyJX6TE8JZ73oX4rOpnjaOQ'
```

### Generate new access tokens

Access tokens are valid for 12 hours, so you'll need to generate new ones regularly.
You can do this by calling [Get Access Token][get-access-token] with your client ID and secret, and then providing the new token to subsequent API calls.

## Key points to remember

* **Secure your credentials** \

  Keep your client ID, client secret, and access tokens confidential.
  Don't share them in publicly accessible locations, such as GitHub repositories or client-side code.

* **HTTPS required** \

  All Eon API requests must be made over HTTPS. If a request is sent over plain HTTP, it fails.

* **Refresh your access tokens**\

  Access tokens expire after 12 hours. Plan to generate new tokens periodically to avoid interruptions in your workflows.

* **Rotate secrets periodically**\

  As a security best practice, you can proactively rotate your client secrets on a regular basis.
  Use [Rotate API Client Secret] or [Rotate Current API Client Secret] to generate a new secret while keeping the same client ID.

[Rotate API Client Secret]: /api/api-reference/auth/rotate-api-client-secret

[Rotate Current API Client Secret]: /api/api-reference/auth/rotate-current-api-client-secret