# integrations.create

Criar integração. Hotmart e Kiwify exigem `secret` (hottok ou token). Webhook de entrada e conectores de saída geram o segredo, devolvido uma única vez nesta resposta. Config: saída `{url (https), events}`; webhook_in `{mapping: {phone, email, name, externalId}}`; Hotmart/Kiwify `{channelId}`.

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

## Entrada

| Campo | Tipo | Obrigatório | Nota |
|---|---|---|---|
| `connector` | string | sim |  |
| `name` | string | sim |  |
| `secret` | string | não |  |
| `config` | object | não |  |

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

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "connector": {
      "type": "string",
      "minLength": 1,
      "maxLength": 40
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80
    },
    "secret": {
      "type": "string",
      "minLength": 8,
      "maxLength": 200
    },
    "config": {
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": {}
    }
  },
  "required": [
    "connector",
    "name"
  ]
}
```

</details>

## Exemplo

```bash
curl -X POST https://app.atomiks.com.br/api/v1/integrations.create \
  -H "Authorization: Bearer $ATOMIKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"connector":"hotmart","name":"Hotmart","secret":"meu-hottok-123"}'
```

CLI:

```bash
node cli/atomiks.mjs integrations.create --json '{"connector":"hotmart","name":"Hotmart","secret":"meu-hottok-123"}'
```

MCP: ferramenta `integrations_create` 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": {
    "id": {
      "type": "string"
    },
    "secret": {
      "type": "string"
    },
    "inboundUrl": {
      "type": [
        "string",
        "null"
      ]
    }
  },
  "required": [
    "id",
    "inboundUrl"
  ],
  "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).
