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

# Histórico de Saldo

> Retorna o histórico de saldo de uma proxy.

Retorna o histórico de movimentações de saldo (cobranças e adições) de um usuário da proxy específico.

## Headers

<ParamField header="X-API-Key" type="string" required>
  Sua chave de API no formato `gm_SUA_CHAVE`.
</ParamField>

## Body

<ParamField body="user_id" type="string" required>
  ID do usuário da proxy a ser consultado.
</ParamField>

## Resposta

<ResponseField name="history" type="array">
  Lista com o histórico de movimentações de saldo.

  <Expandable title="Propriedades">
    <ResponseField name="balance_charged" type="integer">
      Quanto do saldo foi cobrado/descontado.
    </ResponseField>

    <ResponseField name="traffic_added" type="integer">
      Quanto de saldo foi adicionado à conta.
    </ResponseField>

    <ResponseField name="datetime" type="string">
      Data e hora da movimentação (UTC).
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET https://api.gmproxys.com/v1/history \
    -H "X-API-Key: gm_SUA_CHAVE" \
    -H "Content-Type: application/json" \
    -d '{
      "user_id": "5238"
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch("https://api.gmproxys.com/v1/history", {
    method: "GET",
    headers: {
      "X-API-Key": "gm_SUA_CHAVE",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      user_id: "5238",
    }),
  });

  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      "https://api.gmproxys.com/v1/history",
      headers={
          "X-API-Key": "gm_SUA_CHAVE",
          "Content-Type": "application/json",
      },
      json={"user_id": "5238"},
  )

  print(response.json())
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "history": [
      {
        "balance_charged": 1,
        "traffic_added": 1,
        "datetime": "2024-10-09 09:08:37 UTC"
      },
      {
        "balance_charged": 2,
        "traffic_added": 2,
        "datetime": "2024-10-08 13:45:27 UTC"
      },
      {
        "balance_charged": 1,
        "traffic_added": 1,
        "datetime": "2024-10-01 06:31:14 UTC"
      }
    ]
  }
  ```

  ```json 401 Token inválido theme={null}
  {
    "success": false,
    "message": "Invalid API token."
  }
  ```

  ```json 404 Proxy inexistente theme={null}
  {
    "success": false,
    "message": "Proxy user not found."
  }
  ```
</ResponseExample>
