# flows.list

Listar flows. Flows da conta, do mais recente para o mais antigo. Arquivados só com `includeArchived`. `status` filtra. Cada item traz o resumo da versão mais recente: `steps` (nós), `startEvent` (primeiro evento de início ou null), `runs` (execuções de todas as versões) e `layout` (posições e ligações para a miniatura).

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

## Entrada

| Campo | Tipo | Obrigatório | Nota |
|---|---|---|---|
| `status` | "draft" \| "active" \| "paused" \| "archived" | não |  |
| `includeArchived` | boolean | não |  |

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

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "status": {
      "type": "string",
      "enum": [
        "draft",
        "active",
        "paused",
        "archived"
      ]
    },
    "includeArchived": {
      "type": "boolean"
    }
  }
}
```

</details>

## Exemplo

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

CLI:

```bash
node cli/atomiks.mjs flows.list --json '{}'
```

MCP: ferramenta `flows_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"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "active",
              "paused",
              "archived"
            ]
          },
          "publishedVersion": {
            "type": [
              "number",
              "null"
            ]
          },
          "folder": {
            "type": [
              "string",
              "null"
            ]
          },
          "latestVersion": {
            "type": [
              "number",
              "null"
            ]
          },
          "hasDraft": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          },
          "steps": {
            "type": "number"
          },
          "startEvent": {
            "type": [
              "string",
              "null"
            ]
          },
          "runs": {
            "type": "number"
          },
          "layout": {
            "type": "object",
            "properties": {
              "nodes": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    },
                    "x": {
                      "type": "number"
                    },
                    "y": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "id",
                    "type",
                    "x",
                    "y"
                  ],
                  "additionalProperties": false
                }
              },
              "edges": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "from": {
                      "type": "string"
                    },
                    "to": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "from",
                    "to"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "nodes",
              "edges"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "name",
          "status",
          "publishedVersion",
          "folder",
          "latestVersion",
          "hasDraft",
          "createdAt",
          "updatedAt",
          "steps",
          "startEvent",
          "runs",
          "layout"
        ],
        "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).
