> For the complete documentation index, see [llms.txt](https://portal-integracao.intelbras.com.br/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://portal-integracao.intelbras.com.br/linha-de-faciais/modo-online/modo-online-2.0/configurar-via-api.md).

# Configurar via API

Para configurar e habilitar Modo Online 2.0 como servidor de autenticação via API e direcionar as requisições de acesso ao servidor, deve ser realizado as requisições em dois passos, 1° = configuração e 2° = habilitar modo de operação.

### Habilitar Modo Online 2.0 via API - Passo 1

#### Requisição - GET - Básico

`http://192.168.1.201/cgi-bin/configManager.cgi?action=setConfig&Intelbras_ModeCfgII.OnlineAuthServer.Enable=true&Intelbras_ModeCfgII.OnlineAuthServer.Address=192.168.1.108&Intelbras_ModeCfgII.OnlineAuthServer.AuthPath=/auth&Intelbras_ModeCfgII.OnlineAuthServer.Port=3000&Intelbras_ModeCfgII.OnlineAuthServer.KeepAlivePath=/keepalive&Intelbras_ModeCfgII.OnlineAuthServer.Interval=120&Intelbras_ModeCfgII.OnlineAuthServer.RemoteCheckTimeout=5&Intelbras_ModeCfgII.OnlineAuthServer.TimeOut=2000`

| param                   | type    | description                                                                                           |
| ----------------------- | ------- | ----------------------------------------------------------------------------------------------------- |
| `setConfig` \*          | String  | Comando para cadastrar configuração                                                                   |
| `Enable` \*             | Boolean | true/false - Habilita/Desabilitar o servidor de autenticação.                                         |
| `Address` \*            | Number  | Endereço do Servidor                                                                                  |
| `AuthPath` \*           | String  | Path do Servidor de Autenticação, exemplo "/auth"                                                     |
| `Port` \*               | Number  | Porta do Servidor                                                                                     |
| `KeepAlivePath` \*      | String  | Path do Servidor de Autenticação para conexão do Keep Alive. Deve ser usado "/keepalive" como padrão. |
| `Interval` \*           | Number  | Intervalo de requisições do Keep Alive, medido em Segundos. Recomenda-se o valor 10                   |
| `RemoteCheckTimeOut` \* | Number  | Tempo limite para o servidor responder a requisição de autenticação keep alive, recomendado 2000      |
| `TimeOut` \*            | Number  | Tempo limite para o servidor responder o keep alive, recomendado 2000                                 |

#### Requisição - GET - Completo

`http://192.168.1.201/cgi-bin/configManager.cgi?action=setConfig&Intelbras_ModeCfgII.OnlineAuthServer.Enable=true&Intelbras_ModeCfgII.OnlineAuthServer.Address=192.168.1.108&Intelbras_ModeCfgII.OnlineAuthServer.AuthPath=/auth&Intelbras_ModeCfgII.OnlineAuthServer.Port=3000&Intelbras_ModeCfgII.OnlineAuthServer.ReportPicture=true&Intelbras_ModeCfgII.OnlineAuthServer.KeepAlivePath=/keepalive&Intelbras_ModeCfgII.OnlineAuthServer.Interval=120&Intelbras_ModeCfgII.OnlineAuthServer.RemoteCheckTimeout=5&Intelbras_ModeCfgII.OnlineAuthServer.TimeOut=2000&Intelbras_ModeCfgII.OnlineAuthServer.UserType[0]=0&Intelbras_ModeCfgII.OnlineAuthServer.UserType[1]=4&Intelbras_ModeCfgII.OnlineAuthServer.UserType[2]=2&Intelbras_ModeCfgII.OnlineAuthServer.UserType[3]=3&Intelbras_ModeCfgII.OnlineAuthServer.UserType[4]=1&Intelbras_ModeCfgII.OnlineAuthServer.UserType[5]=5&Intelbras_ModeCfgII.OnlineAuthServer.UserType[6]=6&Intelbras_ModeCfgII.OnlineAuthServer.UserType[7]=7&Intelbras_ModeCfgII.OnlineAuthServer.HttpsEnable=false`

| param                   | type    | description                                                                                           |
| ----------------------- | ------- | ----------------------------------------------------------------------------------------------------- |
| `setConfig` \*          | String  | Comando para cadastrar configuração                                                                   |
| `Enable` \*             | Boolean | true/false - Habilita/Desabilitar o servidor de autenticação.                                         |
| `Address` \*            | Number  | Endereço do Servidor                                                                                  |
| `AuthPath` \*           | String  | Path do Servidor de Autenticação, exemplo "/auth"                                                     |
| `Port` \*               | Number  | Porta do Servidor                                                                                     |
| `ReportPicture` \*      | Boolean | Habilita/Desabilita o envio da foto do evento                                                         |
| `KeepAlivePath` \*      | String  | Path do Servidor de Autenticação para conexão do Keep Alive. Deve ser usado "/keepalive" como padrão. |
| `Interval` \*           | Number  | Intervalo de requisições do Keep Alive, medido em Segundos. Recomenda-se o valor 10                   |
| `RemoteCheckTimeOut` \* | Number  | Tempo limite para o servidor responder a requisição de autenticação keep alive, recomendado 2000      |
| `TimeOut` \*            | Number  | Tempo limite para o servidor responder o keep alive, recomendado 2000                                 |
| `UserType[0]` \*        | Number  | `[0~7]`: Define a posição na tabela com relação ao perfil do usuário                                  |
| `HttpsEnable` \*        | Boolean | true/false: Habilita/Desabilita a comunicação utilizando o protocolo HTTPS                            |

Para melhor entendimento do campo `UserType[0]` e como deve ser a sua configuração, segue a explicação detalhada:

* Os valores de 0 a 7 junto ao campo `UserType` é a posição de memória no sistema para os perfis ativos.
* Os valores para os perfis são: `Geral: 0`, `Bloqueado: 1`, `Convidado: 2`, `Ronda: 3`, `VIP: 4`, `Acessibilidade: 5`, `Usuário 1: 6`, `Usuário 2: 7`.
* Portanto, caso queira que somente os perfis `Convidado`, `Acessibilidade` e `Usuário 1`, deve ser repassado para o equipamento da seguinte maneira: Intelbras\_ModeCfgII.OnlineAuthServer.UserType\[0]=2\&Intelbras\_ModeCfgII.OnlineAuthServer.UserType\[1]=5\&Intelbras\_ModeCfgII.OnlineAuthServer.UserType\[2]=6 .
* Para desativar uma posição, basta passar o valor de perfil `8`. Exemplo: Intelbras\_ModeCfgII.OnlineAuthServer.UserType\[4]=8
* Por padrão, o sistema vem ativo as posições de 0 a 5 com a seguinte relação de perfis:&#x20;

| Posição       | Valor | Perfil                |
| ------------- | ----- | --------------------- |
| `UserType[0]` | 0     | Perfil Geral          |
| `UserType[1]` | 1     | Perfil Bloqueado      |
| `UserType[2]` | 2     | Perfil Convidado      |
| `UserType[3]` | 3     | Perfil Ronda          |
| `UserType[4]` | 4     | Perfil VIP            |
| `UserType[5]` | 5     | Perfil Acessibilidade |

{% hint style="warning" %}
Importante: Verifique sempre as configurações de rede do seu produto, como Endereço de IP e Gateway, para garantir que o mesmo esteja acessível na rede.
{% endhint %}

#### Exemplo de Retorno - *text/plain*

```sh
OK
```

### Habilitar Modo Online 2.0 via API - Passo 2

Após a configuração, deve ser ativado o Modo Online 2.0:

`http://{{device_ip}}/cgi-bin/configManager.cgi?action=setConfig&Intelbras_ModeCfg.DeviceMode=3`

| Posição         | Valor  | Perfil                                                                                          |
| --------------- | ------ | ----------------------------------------------------------------------------------------------- |
| `DeviceMode` \* | Number | 0: StandAlone, 1: Servidor de Envio de Eventos, 2: Modo Online, 3: Modo Online/Post Eventos 2.0 |

{% hint style="warning" %}
Verifique sempre as configurações de rede do seu produto, como Endereço de IP e Gateway, para garantir que o mesmo esteja acessível na rede.
{% endhint %}

### Alterar Content-Type

O Modo Online 2.0 os eventos de autenticação encaminhados do dispositivo para o servidor, utilizando o formato Content-Type como **application/json** . Porém, é possível retornar ao método **text/plain** caso seja o interesse e manter a compatibilidade com o Modo Online atual - v.1.0.

Abaixo, segue a requisição que efetua a alteração do Content-Type de JSON para TEXT/PLAIN.

#### Requisição - GET

<http://192.168.1.201/cgi-bin/configManager.cgi?action=setConfig\\&Intelbras\\_UploadContentType.ContentType=jsonv2>

| param            | type   | description                                                               |
| ---------------- | ------ | ------------------------------------------------------------------------- |
| `setConfig` \*   | String | Comando para definir configurações                                        |
| `ContentType` \* | String | `jsonv2` para formato application/json e `text` para o formato text/plain |

#### Exemplo de Retorno - *text/plain*

```sh
OK
```

{% hint style="warning" %}
Importante: Ao alterar o formato do Content-Type de JSON para TEXT/PLAIN, irá afetar o Servidor de Envio de Eventos 2.0.
{% endhint %}

### Servidor de Envio de Eventos 2.0

Como dito, no Modo Online 2.0 o servidor de envio de eventos é separado do servidor de autenticação, sendo que é possível ativar somente um ou ambos, além da possibilidade de usar um servidor de eventos diferente de um servidor de autenticação.

Para maiores informações sobre o Servidor de Envio de Eventos 2.0, consulta a página **Servidor de Envio de Eventos 2.0** .


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://portal-integracao.intelbras.com.br/linha-de-faciais/modo-online/modo-online-2.0/configurar-via-api.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
