> For the complete documentation index, see [llms.txt](https://docs.leadlinks.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.leadlinks.app/api-desenvolvedores/paginacao-e-filtros.md).

# Paginação e filtros

Todos os endpoints de **listagem** (`GET /v1/{recurso}`) são paginados e aceitam filtros via query string.

## Paginação

| Parâmetro  | Padrão | Descrição                          |
| ---------- | ------ | ---------------------------------- |
| `page`     | `1`    | Página atual (começa em 1).        |
| `per_page` | `50`   | Itens por página. **Máximo: 100.** |

```bash
curl "https://api.leadlinks.app/v1/deals?page=2&per_page=100" \
  -H "x-api-key: SUA_CHAVE"
```

A resposta traz o bloco `pagination`:

```json
{
  "success": true,
  "data": [ /* ... */ ],
  "pagination": { "page": 2, "per_page": 100, "total": 350, "total_pages": 4 }
}
```

## Filtro por campo personalizado

É possível filtrar a lista por um **campo personalizado** (apenas `contacts`, `companies` e `deals`):

| Parâmetro            | Descrição                                                |
| -------------------- | -------------------------------------------------------- |
| `custom_field_name`  | Nome (slug), rótulo **ou** alias do campo personalizado. |
| `custom_field_value` | Valor exato a buscar.                                    |

```bash
# Negociações cujo campo "codigo_da_integracao" seja "ABC-123"
curl "https://api.leadlinks.app/v1/deals?custom_field_name=codigo_da_integracao&custom_field_value=ABC-123" \
  -H "x-api-key: SUA_CHAVE"
```

{% hint style="info" %}
O `custom_field_name` resolve por **nome (slug), rótulo ou alias** — então `negotiation_code` encontra um campo cujo slug é `codigo_da_integracao`, por exemplo. Se o campo não existir, a API retorna **`400`**.
{% endhint %}

## Incluir / omitir campos personalizados

Por padrão, a listagem **inclui** os campos personalizados de cada item. Para uma resposta mais enxuta, desative com:

| Parâmetro               | Padrão | Descrição                                         |
| ----------------------- | ------ | ------------------------------------------------- |
| `include_custom_fields` | `true` | `false` omite o objeto `custom_fields` dos itens. |

```bash
curl "https://api.leadlinks.app/v1/contacts?include_custom_fields=false" \
  -H "x-api-key: SUA_CHAVE"
```


---

# 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 dynamically by asking a question.

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

```
GET https://docs.leadlinks.app/api-desenvolvedores/paginacao-e-filtros.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
