> ## Documentation Index
> Fetch the complete documentation index at: https://docs.embedder.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get an Analytics API token

> Create an analytics:read scoped Analytics API token in the Embedder web app, set its expiration, and use it in your first API request.

Create Analytics API tokens from your Embedder account. The token must include the `analytics:read` scope.

<Info>
  Analytics is available to enabled organizations. If the scope or Analytics
  pages are unavailable, contact your Embedder representative.
</Info>

## Create the token

<Steps>
  <Step title="Open your account">
    Sign in to [app.embedder.com](https://app.embedder.com/account), open **Account**, and select the **Tokens** tab.
  </Step>

  <Step title="Start a new token">
    Select **Create token**. Give the token a name that identifies the integration or job that will use it, such as `analytics-dashboard-prod`.
  </Step>

  <Step title="Choose an expiration">
    Select 30 days, 60 days, 90 days, one year, or no expiration. Prefer the shortest lifetime your integration can rotate reliably.
  </Step>

  <Step title="Grant analytics access">
    Under **Scopes**, enable `analytics:read`. A token without this scope cannot read organization Analytics API data.
  </Step>

  <Step title="Generate and copy">
    Select **Generate**, then copy the token immediately. The complete value is shown only once.
  </Step>
</Steps>

Store the value in a secret manager or protected environment variable:

```bash theme={"system"}
export EMBEDDER_ANALYTICS_TOKEN="your-token"
```

<Warning>
  Do not commit the token, put it in a URL, or paste it into logs or shared
  configuration. Revoke it immediately if it is exposed.
</Warning>

## Find your organization ID

Open [Organizations](https://app.embedder.com/organizations) in the web app and select the organization whose usage you want to read. Its URL has this form:

```text theme={"system"}
https://app.embedder.com/organizations/your-organization-id
```

Copy the final path segment:

```bash theme={"system"}
export EMBEDDER_ORGANIZATION_ID="your-organization-id"
```

The token owner's organization membership and role determine which data is available. A scoped token does not grant access to an organization the account cannot already access.

## Test the token

Request an Analytics overview with an explicit ISO 8601 date range:

```bash theme={"system"}
curl --get \
  "https://backend-service-prod.embedder.com/api/v1/organizations/$EMBEDDER_ORGANIZATION_ID/analytics/overview" \
  -H "Authorization: Bearer $EMBEDDER_ANALYTICS_TOKEN" \
  -H "Accept: application/json" \
  --data-urlencode "from=2026-08-01T00:00:00.000Z" \
  --data-urlencode "to=2026-08-08T00:00:00.000Z"
```

A successful request returns JSON containing `totals`, `previous`, and `days`. See the [Analytics API reference](/api-reference/analytics-api) for user, team, and session endpoints.

If the request fails:

* `401`: check that the token was copied completely and has not expired or been revoked.
* `403`: confirm that `analytics:read` was selected, the organization ID belongs to the account, and Analytics is enabled for the organization.
* `429`: wait for the duration in the `Retry-After` response header before retrying.

## Rotate or revoke a token

Create a separate replacement token before removing a token that is in use:

1. In **Account** → **Tokens**, create a new token with `analytics:read`.
2. Put the new value in the integration's secret store.
3. Make a test request with the replacement.
4. Update or restart every process that used the old value.
5. Return to **Tokens** and delete the old token.

Use **Regenerate token** only when you can replace the current value immediately. The regenerated secret is also shown once.
