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

# Login

> Intercambia tus credenciales de cliente por un token de acceso. Usa el token devuelto como Bearer token en todas las peticiones siguientes a la API.

<ParamField header="x-api-key" type="string" required>
  Tu API key de Fire. Se emite desde el dashboard de Fire en **Settings → API Keys**.
</ParamField>

<ParamField header="x-client-channel" type="string" required>
  Debe ser `integration`. Identifica la petición como proveniente de una integración externa.
</ParamField>

<ParamField header="account" type="string" required>
  Identificador de la cuenta a la que pertenece la petición.
</ParamField>

<ParamField header="Content-Type" type="string" required default="application/json">
  Debe ser `application/json` para el cuerpo JSON.
</ParamField>

<ParamField body="client_id" type="string" required>
  Identificador de cliente emitido por Fire.
</ParamField>

<ParamField body="client_secret" type="string" required>
  Secreto de cliente emitido por Fire.
</ParamField>

<ParamField body="grant_type" type="string" required default="client_credentials">
  Tipo de grant OAuth 2.0. Debe ser `client_credentials`.
</ParamField>

<ResponseField name="accessToken" type="string">
  Token de acceso. Inclúyelo en la cabecera `Authorization: Bearer <accessToken>` en todas las peticiones a la API.
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl --location 'https://stg.api.fire.rest/api/authentication/login' \
    --header 'x-api-key: <your_api_key>' \
    --header 'x-client-channel: integration' \
    --header 'account: <your_account_id>' \
    --header 'Content-Type: application/json' \
    --data '{
      "client_id": "<your_client_id>",
      "client_secret": "<your_client_secret>",
      "grant_type": "client_credentials"
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 201 theme={null}
  {
    "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
  }
  ```

  ```json 401 theme={null}
  {
    "error": {
      "code": "unauthorized",
      "message": "Invalid credentials"
    }
  }
  ```
</ResponseExample>
