> 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/ct-3000-2pb-4pb/configuracao-de-credencial-cartao/obter-cartoes-via-userid.md).

# Obter Cartões via UserID

### Obter Cartões via UserID - 1º Request

Esta chamada está dividida em dois passos, primeiramente é iniciada a pesquisa dos cartões vinculados ao usuário utilizando a chamada "Obter Cartões by UserID - Step 1º" onde será repassado seu UserID.

#### Requisição - GET

`http://192.168.1.201/cgi-bin/AccessCard.cgi?action=startFind&Condition.UserID=6`

| param          | type   | description                                        |
| -------------- | ------ | -------------------------------------------------- |
| `startFind` \* | Number | Comando de inicio de pesquisa                      |
| `UserID` \*    | Number | UserID do usuário ao qual deseja buscar os cartões |

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

```sh
{
   "Caps" : 2,
   "Token" : 5,
   "Total" : 2 // Total de cartões do usuário
}
```

#### Exemplos

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

```python
import requests
 
device_ip = '10.1.35.144'
username = 'admin'
password = 'acesso1234'
 
url = "http://{}/cgi-bin/AccessCard.cgi?action=startFind&Condition.UserID=4".format(
                        str(device_ip),
                    )
 
digest_auth = requests.auth.HTTPDigestAuth(username, password)
rval = requests.get(url, auth=digest_auth, stream=True, timeout=20, verify=False)
 
print(rval.text)
```

{% endtab %}
{% endtabs %}

### Obter Cartões via UserID - 2º Request

Após realizar a chamada "Obter Cartões by UserID - Step 1º", realize a finalização da busca repassando as informações de token.

#### Requisição - GET

`http://192.168.1.201/cgi-bin/AccessCard.cgi?action=doFind&Token=5&Offset=0&Count=20`

| param       | type   | description                            |
| ----------- | ------ | -------------------------------------- |
| `doFind` \* | Number | Comando de finalizar pesquisa          |
| `Token` \*  | Number | Token repassado no retorno da pesquisa |
| `Offset` \* | Number | Chave de estado, default 0             |

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

```sh
{
  "Info": [
    {
      "CardName": "",
      "CardNo": "B9BE3FCA",
      "CardStatus": 0,
      "CardType": 0,
      "CreateTime": 0,
      "UserID": "6"
    },
    {
      "CardName": "",
      "CardNo": "000002",
      "CardStatus": 0,
      "CardType": 0,
      "CreateTime": 0,
      "UserID": "6"
    }
  ]
}
```

#### Exemplos

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

```python
import requests
 
device_ip = '10.1.35.144'
username = 'admin'
password = 'acesso1234'
 
url = "http://{}/cgi-bin/AccessCard.cgi?action=doFind&Token=17&Offset=0&Count=20".format(
                          str(device_ip),
                      )
 
digest_auth = requests.auth.HTTPDigestAuth(username, password)
rval = requests.get(url, 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/ct-3000-2pb-4pb/configuracao-de-credencial-cartao/obter-cartoes-via-userid.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.
