# ads.get

Ver um anúncio e as pessoas que vieram por ele. Anúncio (nomes de anúncio, conjunto e campanha, criativo, `permalinkUrl`, `previewLink`, `lookupStatus`) mais o que veio nas mensagens (`headline`, `body`, `imageUrl`, `sourceUrl`) e até 100 contatos cuja primeira indicação é dele, do mais novo ao mais antigo. `people` é o total.

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

## Entrada

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

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

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

</details>

## Exemplo

```bash
curl -X POST https://app.atomiks.com.br/api/v1/ads.get \
  -H "Authorization: Bearer $ATOMIKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"adId":"120210000000001"}'
```

CLI:

```bash
node cli/atomiks.mjs ads.get --json '{"adId":"120210000000001"}'
```

MCP: ferramenta `ads_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": {
    "adId": {
      "type": "string"
    },
    "name": {
      "type": [
        "string",
        "null"
      ]
    },
    "adsetName": {
      "type": [
        "string",
        "null"
      ]
    },
    "campaignName": {
      "type": [
        "string",
        "null"
      ]
    },
    "status": {
      "type": [
        "string",
        "null"
      ]
    },
    "creative": {
      "anyOf": [
        {},
        {
          "type": "null"
        }
      ]
    },
    "permalinkUrl": {
      "type": [
        "string",
        "null"
      ]
    },
    "previewLink": {
      "type": [
        "string",
        "null"
      ]
    },
    "lookupStatus": {
      "type": "string",
      "enum": [
        "pending",
        "ok",
        "not_matched",
        "error"
      ]
    },
    "lookupError": {
      "type": [
        "string",
        "null"
      ]
    },
    "people": {
      "type": "number"
    },
    "headline": {
      "type": [
        "string",
        "null"
      ]
    },
    "body": {
      "type": [
        "string",
        "null"
      ]
    },
    "imageUrl": {
      "type": [
        "string",
        "null"
      ]
    },
    "thumbnailUrl": {
      "type": [
        "string",
        "null"
      ]
    },
    "sourceUrl": {
      "type": [
        "string",
        "null"
      ]
    },
    "contacts": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone": {
            "type": [
              "string",
              "null"
            ]
          },
          "firstSeenAt": {
            "type": "string"
          },
          "origin": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "ad",
                  "organic",
                  "manual",
                  "import",
                  "integration",
                  "instagram",
                  "form",
                  "api"
                ]
              },
              "detail": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "adId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "adName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "campaignName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "headline": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "kind",
              "detail",
              "adId",
              "adName",
              "campaignName",
              "headline"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "name",
          "phone",
          "firstSeenAt",
          "origin"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "adId",
    "name",
    "adsetName",
    "campaignName",
    "status",
    "creative",
    "permalinkUrl",
    "previewLink",
    "lookupStatus",
    "lookupError",
    "people",
    "headline",
    "body",
    "imageUrl",
    "thumbnailUrl",
    "sourceUrl",
    "contacts"
  ],
  "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).
