# Account

## Consulta de saldo

<mark style="color:purple;background-color:purple;">**`GET`**</mark> `https://api-v3.smsfire.com.br/account/balance`

{% hint style="warning" %}
**Rate Limiter:** Este serviço possui um limite global de **10 requisições por minuto** a partir do mesmo IP.
{% endhint %}

{% hint style="info" %}
**Atenção:** o saldo informado pode não estar atualizado em tempo real devido ao uso de cache.
{% endhint %}

### Exemplos de requisição

{% tabs %}
{% tab title="Node.Js" %}

```javascript
const axios = require("axios").default;

const options = {
  method: 'GET',
  url: `https://api-v3.smsfire.com.br/account/balance`,
  headers: {Username: 'seu_usuario', Api_Token: 'seu_token'}
};

axios.request(options).then(function (response) {
  console.log(response.data);
}).catch(function (error) {
  console.error(error);
});
```

{% endtab %}

{% tab title="Php" %}

```php
<?php

$endpoint = "https://api-v3.smsfire.com.br/account/balance";

$curl = curl_init();

curl_setopt_array($curl, [
    CURLOPT_URL => $endpoint,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_HTTPHEADER => [
        "Api_Token: seu_token",
        "Username: seu_usuario",
    ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
    echo "cURL Error #:" . $err;
} else {
    echo $response;
}

```

{% endtab %}

{% tab title="C-Sharp" %}

```cs
using System.Net.Http;
using Microsoft.AspNetCore.WebUtilities; // precisa do pacote Microsoft.AspNetCore.WebUtilities

var client = new HttpClient();

var endpoint = $"https://api-v3.smsfire.com.br/account/balance";

var request = new HttpRequestMessage
{
    Method = HttpMethod.Get,
    RequestUri = new Uri(endpoint),
    Headers =
    {
        { "Api_Token", "seu_token" },
        { "Username", "seu_usuario" }
    }
};

using var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();

var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);

```

{% endtab %}

{% tab title="Shell/cURL" %}

```bash
curl --request GET \
  --url 'https://api-v3.smsfire.com.br/account/balance' \
  --header 'Api_Token: seu_token' \
  --header 'Username: seu_usuario'
```

{% endtab %}
{% endtabs %}

### Response

O conjunto de dados retornados será em formato [JSON](https://en.wikipedia.org/wiki/JSON) com detalhes do envio ou possível falha da requisição

{% tabs %}
{% tab title="200 - OK" %}

```json
{
	"balance": 9.102,
	"limit": -10,
	"currency":"BRL"
}
```

{% endtab %}

{% tab title="4xx - Erro" %}
Erros poderão ser facilmente filtrados a partir dos códigos HTTP retornados e adicionalmente detalhes do erro serão incluídos no JSON que seguirá o seguinte formato:

```json
{
	"message": "Invalid Token or Username",
	"error": "Unauthorized",
	"statusCode": 400
}
```

{% endtab %}

{% tab title="5xx - Erro" %}
Requisições que tenham o retorno de algum código HTTP deste nível é devido a falhas internas da API ou servidor.

Neste tipo de situação, entre em contato com a equipe de suporte
{% endtab %}

{% tab title="Tabela de parâmetros" %}

| Parâmetro     | Tipo   | Descrição                                                                                                                                               |
| ------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| balance       | number | Saldo atual disponível                                                                                                                                  |
| limit         | number | Limite de crédito disponível                                                                                                                            |
| currency      | string | Código de moeda da conta formatado em [ISO4217](https://en-wikipedia-org.translate.goog/wiki/ISO_4217?_x_tr_sl=en&_x_tr_tl=pt&_x_tr_hl=pt&_x_tr_pto=tc) |
| {% endtab %}  |        |                                                                                                                                                         |
| {% endtabs %} |        |                                                                                                                                                         |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.smsfire.com.br/apis-v3/account.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
