# audit_hub.list

Auditoria da conta. Quem alterou o quê na conta, quando e por qual canal, do mais recente ao mais antigo (último ano). Filtros por período, área, ação, canal, papel, pessoa, item e busca. Use `before` (id do último item) para a página seguinte.

- Endpoint: `POST https://app.atomiks.com.br/api/v1/audit_hub.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_hub_list`
- Ficha em JSON: `https://app.atomiks.com.br/api/v1/openapi.json` (operationId `audit_hub.list`)

## Entrada

| Campo | Tipo | Obrigatório | Nota |
|---|---|---|---|
| `from` | string (date-time) | não |  |
| `to` | string (date-time) | não |  |
| `resources` | string[] | não |  |
| `actions` | "create" \| "update" \| "delete" \| "manage" \| "import" \| "export" \| "publish" \| "unpublish" \| "activate" \| "pause" \| "archive" \| "duplicate"[] | não |  |
| `channels` | "user" \| "ai" \| "api" \| "flow" \| "system"[] | não |  |
| `roles` | "owner" \| "admin" \| "member" \| "integrator"[] | não |  |
| `people` | string (uuid)[] | não |  |
| `search` | string | não |  |
| `entity` | string | não |  |
| `before` | integer | não |  |
| `limit` | integer | não | padrão 30 |

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

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "from": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
    },
    "to": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
    },
    "resources": {
      "maxItems": 60,
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 64
      }
    },
    "actions": {
      "maxItems": 12,
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "create",
          "update",
          "delete",
          "manage",
          "import",
          "export",
          "publish",
          "unpublish",
          "activate",
          "pause",
          "archive",
          "duplicate"
        ]
      }
    },
    "channels": {
      "maxItems": 5,
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "user",
          "ai",
          "api",
          "flow",
          "system"
        ]
      }
    },
    "roles": {
      "maxItems": 4,
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "owner",
          "admin",
          "member",
          "integrator"
        ]
      }
    },
    "people": {
      "maxItems": 100,
      "type": "array",
      "items": {
        "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)$"
      }
    },
    "search": {
      "type": "string",
      "maxLength": 120
    },
    "entity": {
      "type": "string",
      "maxLength": 255
    },
    "before": {
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991
    },
    "limit": {
      "default": 30,
      "type": "integer",
      "minimum": 1,
      "maximum": 100
    }
  }
}
```

</details>

## Exemplo

```bash
curl -X POST https://app.atomiks.com.br/api/v1/audit_hub.list \
  -H "Authorization: Bearer $ATOMIKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"limit":30}'
```

CLI:

```bash
node cli/atomiks.mjs audit_hub.list --json '{"limit":30}'
```

MCP: ferramenta `audit_hub_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"
          },
          "createdAt": {
            "type": "string"
          },
          "action": {
            "type": "string",
            "enum": [
              "create",
              "update",
              "delete",
              "manage",
              "import",
              "export",
              "publish",
              "unpublish",
              "activate",
              "pause",
              "archive",
              "duplicate"
            ]
          },
          "rawAction": {
            "type": "string"
          },
          "resource": {
            "type": "string"
          },
          "entityId": {
            "type": [
              "string",
              "null"
            ]
          },
          "channel": {
            "type": "string",
            "enum": [
              "user",
              "ai",
              "api",
              "flow",
              "system"
            ]
          },
          "actor": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "email": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "imageUrl": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "id",
                  "name",
                  "email",
                  "imageUrl"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "actorRole": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "owner",
                  "admin",
                  "member",
                  "integrator"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "ip": {
            "type": [
              "string",
              "null"
            ]
          },
          "input": {
            "anyOf": [
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              {
                "type": "null"
              }
            ]
          },
          "method": {
            "type": "string"
          },
          "route": {
            "type": "string"
          },
          "statusCode": {
            "type": "number"
          }
        },
        "required": [
          "id",
          "createdAt",
          "action",
          "rawAction",
          "resource",
          "entityId",
          "channel",
          "actor",
          "actorRole",
          "ip",
          "input",
          "method",
          "route",
          "statusCode"
        ],
        "additionalProperties": false
      }
    },
    "nextBefore": {
      "type": [
        "number",
        "null"
      ]
    },
    "total": {
      "type": [
        "number",
        "null"
      ]
    }
  },
  "required": [
    "items",
    "nextBefore",
    "total"
  ],
  "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).
