Ver .md

custom_fields.create

Criar campo customizado de Contatos ou Oportunidades. Cria o campo no escopo entityType. fieldName (a-z, 0-9, _) sai do nome de exibição se omitido (repetido informado dá invalid_input; o gerado ganha _2, _3). groupName põe o campo num grupo. Os tipos select, multi_select e radio exigem options (lista de textos ou {label, value}); os demais não aceitam. O tipo e a chave não mudam depois. Vai para o fim da lista.

  • Endpoint: POST https://app.atomiks.com.br/api/v1/custom_fields.create (corpo JSON)
  • Quem pode chamar: administrador da conta
  • Escopo da chave: crm:write
  • Grava dados: sim
  • Pela chave de API: sim
  • Ferramenta MCP: custom_fields_create
  • Ficha em JSON: https://app.atomiks.com.br/api/v1/openapi.json (operationId custom_fields.create)

Entrada

CampoTipoObrigatórioNota
entityType"leads" | "opportunities"sim
displayNamestringsim
fieldNamestringnão
fieldType"text" | "textarea" | "number" | "currency" | "percentage" | "date" | "select" | "multi_select" | "radio" | "link" | "rating" | "boolean" | "file" | "image"sim
groupNamestring | nullnão
optionsstring | object[]não
JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "entityType": {
      "type": "string",
      "enum": [
        "leads",
        "opportunities"
      ]
    },
    "displayName": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80
    },
    "fieldName": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9_]{0,39}$"
    },
    "fieldType": {
      "type": "string",
      "enum": [
        "text",
        "textarea",
        "number",
        "currency",
        "percentage",
        "date",
        "select",
        "multi_select",
        "radio",
        "link",
        "rating",
        "boolean",
        "file",
        "image"
      ]
    },
    "groupName": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 60
        },
        {
          "type": "null"
        }
      ]
    },
    "options": {
      "maxItems": 50,
      "type": "array",
      "items": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "object",
            "properties": {
              "label": {
                "type": "string"
              },
              "value": {
                "type": "string"
              }
            },
            "required": [
              "label"
            ]
          }
        ]
      }
    }
  },
  "required": [
    "entityType",
    "displayName",
    "fieldType"
  ]
}

Exemplo

curl -X POST https://app.atomiks.com.br/api/v1/custom_fields.create \
  -H "Authorization: Bearer $ATOMIKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"entityType":"leads","displayName":"Cidade","fieldType":"text"}'

CLI:

node cli/atomiks.mjs custom_fields.create --json '{"entityType":"leads","displayName":"Cidade","fieldType":"text"}'

MCP: ferramenta custom_fields_create com a mesma entrada.

Saída

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

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "objectId": {
      "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"
      ]
    },
    "required": {
      "type": "boolean"
    },
    "filterable": {
      "type": "boolean"
    },
    "pinned": {
      "type": "boolean"
    },
    "isActive": {
      "type": "boolean"
    },
    "position": {
      "type": "number"
    },
    "usageCount": {
      "type": "number"
    },
    "usageByKind": {
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": {
        "type": "number"
      }
    },
    "fillRate": {
      "type": "number"
    },
    "filledCount": {
      "type": "number"
    },
    "totalRecords": {
      "type": "number"
    },
    "isTitle": {
      "type": "boolean"
    },
    "groupName": {
      "type": [
        "string",
        "null"
      ]
    },
    "unique": {
      "type": "boolean"
    },
    "lastEditedAt": {
      "type": [
        "string",
        "null"
      ]
    },
    "createdAt": {
      "type": "string"
    }
  },
  "required": [
    "id",
    "objectId",
    "fieldName",
    "displayName",
    "fieldType",
    "options",
    "description",
    "required",
    "filterable",
    "pinned",
    "isActive",
    "position",
    "usageCount",
    "usageByKind",
    "fillRate",
    "filledCount",
    "totalRecords",
    "isTitle",
    "groupName",
    "unique",
    "lastEditedAt",
    "createdAt"
  ],
  "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).