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

# Generate an API Token

Tokens are used to interact with the Flare API.
They can be generated using an API key provided via the Authorization header.

API tokens expire after 1 hour.

The endpoint returns an API token via the response body, but also via cookies which can then be used in future HTTP requests.

For more information about authentication, see the
[API Authentication Guide <Icon icon="book" size={16} />](/concepts/authentication/).

<ResponseExample>
  ```json Response Example theme={null}
  {
    "refresh_token_exp": 1723673997,
    "token": "i-am-an-example-api-token"
  }
  ```

  ```json Response Schema theme={null}
  {
    "refresh_token_exp": <number (unix timestamp)>,
    "token": "<string>"
  }
  ```
</ResponseExample>

## Auth Headers

<ParamField header="Authorization" type="string" required>
  Your Flare API key.
</ParamField>

## Body Parameters

<ParamField body="tenant_id" type="number">
  The tenant you want to authenticate to.

  <Note>
    When unspecified, the API token will be generated for your default tenant.
  </Note>
</ParamField>

## Response Fields

<ResponseField name="token" type="string">
  The generated API token.
</ResponseField>

<ResponseField name="refresh_token_exp" type="number">
  Unix timestamp of the expiration of the refresh token.

  (The refresh token is returned in cookies).
</ResponseField>
