# audit.list

Auditoria de um contato. Só administradores. Alterações registradas na atividade da conta que citam o contato (alvo da ação, `contactId` da entrada ou dentro de `ids`/`contactIds`/`target.ids`), da mais recente para a mais antiga. Ação em massa por filtro ("todos os que casam") não cita os ids e não aparece aqui. `actor` null = sistema. Paginação: `before` = `nextBefore` (id da linha).

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

## Entrada

| Campo | Tipo | Obrigatório | Nota |
|---|---|---|---|
| `resource` | "contact" | sim |  |
| `id` | string (uuid) | sim |  |
| `before` | integer | não |  |
| `limit` | integer | não |  |

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

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "resource": {
      "type": "string",
      "const": "contact"
    },
    "id": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "before": {
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991
    },
    "limit": {
      "type": "integer",
      "minimum": 1,
      "maximum": 100
    }
  },
  "required": [
    "resource",
    "id"
  ]
}
```

</details>

## Exemplo

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

CLI:

```bash
node cli/atomiks.mjs audit.list --json '{"resource":"contact","id":"00000000-0000-0000-0000-000000000000"}'
```

MCP: ferramenta `audit_list` 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": {
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "number"
          },
          "at": {
            "type": "string"
          },
          "actor": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "action": {
            "type": "string"
          },
          "summary": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "at",
          "actor",
          "action",
          "summary"
        ],
        "additionalProperties": false
      }
    },
    "nextBefore": {
      "type": [
        "number",
        "null"
      ]
    }
  },
  "required": [
    "items",
    "nextBefore"
  ],
  "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).
