# cadences.runs_list

Cadências de uma oportunidade. Execuções da oportunidade, da mais recente à mais antiga (`opportunityId` é o id do card). `status`: `active` (em andamento), `paused` (pausada: `statusReason` `existing_next_action` = a oportunidade já tinha outra próxima ação aberta), `completed` (deu certo na última fase), `exhausted` (todos os passos sem resultado positivo), `stopped` (`statusReason`: `won`, `lost`, `removed`, `stage_changed`). Traz fase e passo atuais, a próxima ação (`currentTaskTitle`, `currentTaskStatus`, `nextAt`) e as datas.

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

## Entrada

| Campo | Tipo | Obrigatório | Nota |
|---|---|---|---|
| `opportunityId` | string (uuid) | sim |  |

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

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "opportunityId": {
      "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)$"
    }
  },
  "required": [
    "opportunityId"
  ]
}
```

</details>

## Exemplo

```bash
curl -X POST https://app.atomiks.com.br/api/v1/cadences.runs_list \
  -H "Authorization: Bearer $ATOMIKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"opportunityId":"00000000-0000-0000-0000-000000000000"}'
```

CLI:

```bash
node cli/atomiks.mjs cadences.runs_list --json '{"opportunityId":"00000000-0000-0000-0000-000000000000"}'
```

MCP: ferramenta `cadences_runs_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": "string"
          },
          "cadenceId": {
            "type": "string"
          },
          "cadenceName": {
            "type": "string"
          },
          "opportunityId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "paused",
              "completed",
              "exhausted",
              "stopped"
            ]
          },
          "statusReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "phase": {
            "type": [
              "number",
              "null"
            ]
          },
          "phaseName": {
            "type": [
              "string",
              "null"
            ]
          },
          "totalPhases": {
            "type": "number"
          },
          "phaseStep": {
            "type": "number"
          },
          "phaseSteps": {
            "type": "number"
          },
          "currentPosition": {
            "type": "number"
          },
          "totalSteps": {
            "type": "number"
          },
          "currentTaskId": {
            "type": [
              "string",
              "null"
            ]
          },
          "currentTaskTitle": {
            "type": [
              "string",
              "null"
            ]
          },
          "currentTaskStatus": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "open",
                  "done"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "nextAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "automatic": {
            "type": "boolean"
          },
          "startedAt": {
            "type": "string"
          },
          "finishedAt": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "cadenceId",
          "cadenceName",
          "opportunityId",
          "status",
          "statusReason",
          "phase",
          "phaseName",
          "totalPhases",
          "phaseStep",
          "phaseSteps",
          "currentPosition",
          "totalSteps",
          "currentTaskId",
          "currentTaskTitle",
          "currentTaskStatus",
          "nextAt",
          "automatic",
          "startedAt",
          "finishedAt"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "items"
  ],
  "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).
