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

> Troque suas credenciais de cliente por um token de acesso. Use o token retornado como Bearer token em todas as requisições subsequentes à API.

<ParamField header="x-api-key" type="string" required>
  Sua API key do Fire. Emitida pelo dashboard do Fire em **Settings → API Keys**.
</ParamField>

<ParamField header="x-client-channel" type="string" required>
  Deve ser `integration`. Identifica a requisição como vinda de uma integração externa.
</ParamField>

<ParamField header="account" type="string" required>
  Identificador da conta à qual a requisição pertence.
</ParamField>

<ParamField header="Content-Type" type="string" required default="application/json">
  Deve ser `application/json` para o corpo JSON.
</ParamField>

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

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

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

<ResponseField name="accessToken" type="string">
  Token de acesso. Inclua-o no cabeçalho `Authorization: Bearer <accessToken>` em todas as requisições à 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>
