# custom_fields.values_get

Valores dos campos customizados de uma oportunidade. Os campos ativos de Oportunidades (`custom_fields.list` com `entityType: opportunities`), cada um com o `value` gravado na oportunidade `id` (nulo quando vazio), na ordem da tela: é o que a gaveta da oportunidade mostra. O valor segue o tipo: texto, número, `AAAA-MM-DD`, opção, lista de opções (`multi_select`), sim/não, link, 1 a 5 (`rating`) ou id de arquivo.

- Endpoint: `POST https://app.atomiks.com.br/api/v1/custom_fields.values_get` (corpo JSON)
- Quem pode chamar: membro da conta
- Escopo da chave: `crm:read`
- Grava dados: não
- Pela chave de API: sim
- Ferramenta MCP: `custom_fields_values_get`
- Ficha em JSON: `https://app.atomiks.com.br/api/v1/openapi.json` (operationId `custom_fields.values_get`)

## Entrada

| Campo | Tipo | Obrigatório | Nota |
|---|---|---|---|
| `entity` | "opportunity" | sim |  |
| `id` | string (uuid) | sim |  |

<details><summary>JSON Schema</summary>

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "entity": {
      "type": "string",
      "const": "opportunity"
    },
    "id": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    }
  },
  "required": [
    "entity",
    "id"
  ]
}
```

</details>

## Exemplo

```bash
curl -X POST https://app.atomiks.com.br/api/v1/custom_fields.values_get \
  -H "Authorization: Bearer $ATOMIKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"entity":"opportunity","id":"00000000-0000-0000-0000-000000000000"}'
```

CLI:

```bash
node cli/atomiks.mjs custom_fields.values_get --json '{"entity":"opportunity","id":"00000000-0000-0000-0000-000000000000"}'
```

MCP: ferramenta `custom_fields_values_get` com a mesma entrada.

## Saída

Sucesso: `{"data": ...}` com o formato abaixo.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "customFields": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "fieldName": {
            "type": "string"
          },
          "displayName": {
            "type": "string"
          },
          "fieldType": {
            "type": "string",
            "enum": [
              "text",
              "textarea",
              "number",
              "currency",
              "percentage",
              "date",
              "select",
              "multi_select",
              "radio",
              "link",
              "rating",
              "boolean",
              "file",
              "image"
            ]
          },
          "options": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "label": {
                      "type": "string"
                    },
                    "value": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "label",
                    "value"
                  ],
                  "additionalProperties": false
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "groupName": {
            "type": [
              "string",
              "null"
            ]
          },
          "required": {
            "type": "boolean"
          },
          "pinned": {
            "type": "boolean"
          },
          "position": {
            "type": "number"
          },
          "value": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "fieldName",
          "displayName",
          "fieldType",
          "options",
          "description",
          "groupName",
          "required",
          "pinned",
          "position",
          "value"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "customFields"
  ],
  "additionalProperties": false
}
```

## Erros

`{"error": {"code", "message", "requestId"}}`. Códigos: `invalid_input` (400), `unauthorized` (401), `forbidden` / `account_pending` / `scope_missing` (403), `not_found` (404), `limit_reached` (409), `internal` (500).
