# Autenticação

Todo usuário possui um **TOKEN** que pode ser alterado a qualquer momento sem que afete o acesso ao Portal Smsfire. Ao alterar o TOKEN, será gerado um novo código aleatório único.

Para obter o seu *token*, acesse o menu **CONFIGURAÇÕES** de sua conta.

<div data-full-width="false"><figure><img src="/files/WcXbGWLJ9odJ3G5sKunu" alt=""><figcaption><p>Passo a passo para acessar TOKENS de autenticação</p></figcaption></figure></div>

## HTTP

Para a utilização de todas as APIs via protocolo HTTP é necessário encaminhar via **HEADERS** os dados de usuário e token na seguinte forma:

| Chave      | Valor                  |
| ---------- | ---------------------- |
| Username   | Nome do seu usuário    |
| Api\_Token | Token único do usuário |

### Exemplo de utilização

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

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

const headers = {
    Username: 'seu_usuario', 
    Api_Token: 'seu_token'
};

axios.request({
  method: 'GET',
  url: 'http://....',
  params: ...
  headers
});
```

{% endtab %}

{% tab title="Php" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://...",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "",
  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" %}

```csharp
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Get,
    RequestUri = new Uri("https://...."),
    Headers =
    {
        { "Username", "seu_usuario" },
        { "Api_Token", "seu_token" },
    },
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
```

{% endtab %}

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

```sh
curl --request GET \
  --url 'https://...' \
  --header 'Api_Token: seu_token' \
  --header 'Username: seu_usuario'
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
Quando a autenticação falhar seja por dados inválidos ou ausentes a requisição retornará com o código **HTTP 401 Unauthorized**
{% endhint %}

## SMPP

Para a conexão será necessário utilizar seu usuário e o **TOKEN SMPP** para que a conexão seja estabelecida na seguinte forma

| Parâmetro  | Valor                  |
| ---------- | ---------------------- |
| system\_id | Nome do seu usuário    |
| password   | Token único do usuário |

{% content-ref url="/pages/OoN2JgYUwp8GbUOBjypG" %}
[SMPP](/apis-v3/sms/smpp.md)
{% endcontent-ref %}


---

# 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/autenticacao.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.
