# capi.settings_update

Alterar configuração das conversões. Altera a configuração das conversões. Campos omitidos não mudam; `pageId` e `testEventCode` aceitam `null` para limpar.

- Endpoint: `POST https://app.atomiks.com.br/api/v1/capi.settings_update` (corpo JSON)
- Quem pode chamar: administrador da conta
- Escopo da chave: `conversions:write`
- Grava dados: sim
- Pela chave de API: sim
- Ferramenta MCP: `capi_settings_update`
- Ficha em JSON: `https://app.atomiks.com.br/api/v1/openapi.json` (operationId `capi.settings_update`)

## Entrada

| Campo | Tipo | Obrigatório | Nota |
|---|---|---|---|
| `enabled` | boolean | não |  |
| `purchaseOnSale` | boolean | não |  |
| `leadOnCtwa` | boolean | não |  |
| `pageId` | string \| null | não |  |
| `testEventCode` | string \| null | não |  |

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

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "enabled": {
      "type": "boolean"
    },
    "purchaseOnSale": {
      "type": "boolean"
    },
    "leadOnCtwa": {
      "type": "boolean"
    },
    "pageId": {
      "anyOf": [
        {
          "type": "string",
          "pattern": "^[0-9]+$"
        },
        {
          "type": "null"
        }
      ]
    },
    "testEventCode": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 60
        },
        {
          "type": "null"
        }
      ]
    }
  }
}
```

</details>

## Exemplo

```bash
curl -X POST https://app.atomiks.com.br/api/v1/capi.settings_update \
  -H "Authorization: Bearer $ATOMIKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"enabled":true}'
```

CLI:

```bash
node cli/atomiks.mjs capi.settings_update --json '{"enabled":true}'
```

MCP: ferramenta `capi_settings_update` 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": {
    "enabled": {
      "type": "boolean"
    },
    "purchaseOnSale": {
      "type": "boolean"
    },
    "leadOnCtwa": {
      "type": "boolean"
    },
    "pageId": {
      "type": [
        "string",
        "null"
      ]
    },
    "testEventCode": {
      "type": [
        "string",
        "null"
      ]
    }
  },
  "required": [
    "enabled",
    "purchaseOnSale",
    "leadOnCtwa",
    "pageId",
    "testEventCode"
  ],
  "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).
