> 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/campos-personalizados.md).

# Campos personalizados

Contatos, Empresas e Negociações podem ter **campos personalizados** definidos na conta. A API permite **gravar** e **ler** esses valores.

## Gravar (criar/atualizar)

Envie um objeto **`custom_fields`** no corpo, com `slug_do_campo: valor`:

```json
{
  "name": "Maria Santos",
  "email": "maria@empresa.com",
  "custom_fields": {
    "origem_lead": "indicacao",
    "cargo_nivel": "diretor"
  }
}
```

* A chave é o **slug** do campo (ex.: `origem_lead`). Aliases e rótulos também são aceitos.
* Funciona tanto no **`POST`** (criar) quanto no **`PATCH`** (atualizar).
* Campos não reconhecidos são ignorados (não geram erro).

## Ler

Ao **obter** um recurso (`GET /v1/{recurso}/{id}`) ou **listar**, cada item traz um objeto `custom_fields` com **valor, rótulo e tipo** de cada campo preenchido:

```json
{
  "success": true,
  "data": {
    "id": "550e8400-...",
    "name": "Maria Santos",
    "custom_fields": {
      "origem_lead": {
        "value": "indicacao",
        "label": "Origem do Lead",
        "type": "list"
      }
    }
  }
}
```

{% hint style="info" %}
Na **listagem**, use `include_custom_fields=false` para omitir esse objeto e deixar a resposta mais leve. Veja [**Paginação e filtros**](/api-desenvolvedores/paginacao-e-filtros.md).
{% endhint %}

## `custom_attributes` (chave-valor livre)

Além dos campos personalizados estruturados, os recursos aceitam um objeto **`custom_attributes`** (JSON livre) para metadados arbitrários:

```json
{ "name": "Empresa X", "custom_attributes": { "external_id": "crm-legacy-42" } }
```


---

# 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/campos-personalizados.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.
