> 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/visao-geral.md).

# Visão geral

A API do Lead Links é **REST**, autenticada por **chave de API** (`x-api-key`), e expõe duas frentes:

|                            | Base URL                                                | Para quê                                                                                                                   |
| -------------------------- | ------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| **API Pública (CRUD)**     | `https://api.leadlinks.app/v1`                          | Ler e escrever **Contatos**, **Empresas**, **Negociações** e **Produtos**, com campos personalizados, paginação e filtros. |
| **Criar Lead (unificado)** | `https://api.leadlinks.app/public/tracking/create-lead` | Criar Contato + Empresa + Negociação em **uma só chamada**, com UTMs, consentimentos (LGPD) e deduplicação.                |

{% hint style="info" %}
A rota legada `/public-api/{recurso}` continua funcionando como **alias** de `/v1/{recurso}` (mesmos endpoints).
{% endhint %}

## Convenções

* **Formato:** todo corpo de requisição e resposta é **JSON** (`Content-Type: application/json`).
* **Autenticação:** header `x-api-key: SUA_CHAVE` em toda chamada. Veja [**Autenticação**](/api-desenvolvedores/autenticacao.md).
* **IDs:** são **UUID** (ex.: `550e8400-e29b-41d4-a716-446655440000`).
* **Datas:** ISO 8601 (`2024-06-15` ou `2024-06-15T10:30:00Z`).
* **Dinheiro:** número decimal na moeda da conta (ex.: `1500.00`).

## Envelope de resposta

As respostas de sucesso seguem um envelope consistente:

```json
{
  "success": true,
  "data": { /* objeto ou lista */ }
}
```

Listas incluem **paginação**:

```json
{
  "success": true,
  "data": [ /* ... */ ],
  "pagination": { "page": 1, "per_page": 50, "total": 150, "total_pages": 3 }
}
```

Erros retornam `{"error": "mensagem"}` com o status HTTP apropriado.

## Códigos de status

| Código | Significado                                                 |
| ------ | ----------------------------------------------------------- |
| `200`  | OK — requisição bem-sucedida                                |
| `201`  | Criado — recurso criado com sucesso                         |
| `400`  | Requisição inválida — dados ausentes ou incorretos          |
| `401`  | Não autenticado — chave de API ausente ou inválida          |
| `403`  | Proibido — sem permissão ou recurso não habilitado na conta |
| `404`  | Não encontrado — recurso inexistente                        |
| `405`  | Método não permitido                                        |
| `500`  | Erro interno do servidor                                    |

## Métodos disponíveis (CRUD)

Para cada recurso (`contacts`, `companies`, `deals`, `products`):

| Método  | Caminho              | Ação                |
| ------- | -------------------- | ------------------- |
| `POST`  | `/v1/{recurso}`      | Criar               |
| `GET`   | `/v1/{recurso}`      | Listar (paginado)   |
| `GET`   | `/v1/{recurso}/{id}` | Obter um            |
| `PATCH` | `/v1/{recurso}/{id}` | Atualizar (parcial) |

{% hint style="warning" %}
Não há `DELETE` na API pública (paridade intencional). Exclusões são feitas pelo painel.
{% endhint %}


---

# 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/visao-geral.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.
