# sales.buyer

Dados do comprador da venda. Nome, e-mail, telefone (separado em DDI, DDD e número), documento e endereço do contato da venda.

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

## Entrada

| Campo | Tipo | Obrigatório | Nota |
|---|---|---|---|
| `id` | string | sim |  |

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

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200
    }
  },
  "required": [
    "id"
  ]
}
```

</details>

## Exemplo

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

CLI:

```bash
node cli/atomiks.mjs sales.buyer --json '{"id":"00000000-0000-0000-0000-000000000000"}'
```

MCP: ferramenta `sales_buyer` 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": {
    "buyer": {
      "type": "object",
      "properties": {
        "name": {
          "type": [
            "string",
            "null"
          ]
        },
        "email": {
          "type": [
            "string",
            "null"
          ]
        },
        "leadId": {
          "type": [
            "string",
            "null"
          ]
        },
        "document": {
          "type": [
            "string",
            "null"
          ]
        },
        "telephone": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "countryCode": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "areaCode": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "number": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "countryCode",
                "areaCode",
                "number"
              ],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "name",
        "email",
        "leadId",
        "document",
        "telephone"
      ],
      "additionalProperties": false
    },
    "address": {
      "type": "object",
      "properties": {
        "country": {
          "type": [
            "string",
            "null"
          ]
        },
        "complement": {
          "type": [
            "string",
            "null"
          ]
        },
        "state": {
          "type": [
            "string",
            "null"
          ]
        },
        "street": {
          "type": [
            "string",
            "null"
          ]
        },
        "neighborhood": {
          "type": [
            "string",
            "null"
          ]
        },
        "zipCode": {
          "type": [
            "string",
            "null"
          ]
        },
        "number": {
          "type": [
            "string",
            "null"
          ]
        },
        "city": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "country",
        "complement",
        "state",
        "street",
        "neighborhood",
        "zipCode",
        "number",
        "city"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "buyer",
    "address"
  ],
  "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).
