> 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/ss-3710-uhf/configuracao-de-credencial-cartao/cadastrar-cartoes.md).

# Cadastrar Cartões

### Cadastrar Cartões

O comando abaixo permite atribuir um cartão (tag) para cada um usuário. Para cada cartão, é necessário informar o ID do usuário e seu respectivo código. O comando retorna um texto com o status da operação.

{% hint style="warning" %}
Para realizar o vinculo da credencial com o usuário, é necessário que o mesmo esteja cadastrado préviamente - Os dados do cartão devem sem cadastrados em maiúsculo e em hexadecimal. Exemplo: 12EA3004&#x20;

Obs: Não é possivel realizar o Update/Atualização do cartão. Se faz necessário realizar a remoção do cartão desejado e a adição do novo cartão ao usuário. Permitido no máximo 10 cartões por requisição.
{% endhint %}

#### Requisição - POST

`http://192.168.1.201/cgi-bin/AccessCard.cgi?action=insertMulti`

#### Body - *application/json*

```sh
   {
    "CardList": [
      {
        "UserID": "6",
        "CardNo": "000001",
        "CardType": 0,
        "CardStatus": 0
      },
      {
        "UserID": "7",
        "CardNo": "000002",
        "CardType": 0,
        "CardStatus": 0
      },
      {
        "UserID": "9",
        "CardNo": "12EA3004",
        "CardType": 0,
        "CardStatus": 0
      }
    ]
  }
```

| param           | type   | description                                                                                                                |
| --------------- | ------ | -------------------------------------------------------------------------------------------------------------------------- |
| `UserID` \*     | Number | ID do Usuário, exemplo: `16`.                                                                                              |
| `CardNo` \*     | String | Número do Cartão, `12EA3004`                                                                                               |
| `CardType` \*   | Number | Tipo do Cartão `0: Ordinary card`, `1: VIP card`, `2: Guest card`, `3: Patrol card`, `4: Blocklist card`, `5: Duress card` |
| `CardStatus` \* | Number | Status do Cartão `0: Normal`, `1: Cancelado`, `2: Congelado`                                                               |

Permitido no máximo 10 cartões por requisição.

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

```sh
{
	"ErrorCode":	1,
	"Message":	"SUCCESS"
}
```

Caso a variável "ErrorCode" retorne o valor "0", indica que o banco de dados está ocupado e não será possível cadastrar o usuário naquele momento (opção válida a partir do firmware 20251029 ou superior).

#### Exemplos

{% tabs %}
{% tab title="Python" %}

```python
import requests
 
device_ip = '10.1.35.144'
username = 'admin'
password = 'acesso1234'
 
CardList = (
 
        '''{
                "CardList": [
                    {
                        "UserID": "4",
                        "CardNo": "6710BF",
                        "CardType": "0"  ,
                        "CardStatus": "0"
                    }
                ]
            }''' )
 
url = "http://{}/cgi-bin/AccessCard.cgi?action=insertMulti".format(
                        str(device_ip),
                    )
 
digest_auth = requests.auth.HTTPDigestAuth(username, password)
rval = requests.get(url, data=CardList, auth=digest_auth, stream=True, timeout=20, verify=False)
 
print(rval.text)
```

{% endtab %}
{% endtabs %}


---

# 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/ss-3710-uhf/configuracao-de-credencial-cartao/cadastrar-cartoes.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.
