# proposals.list

Listar propostas. Propostas consolidadas da conta, com contato, oportunidade (valor em centavos) e modelo. Filtros combinados com E: `statuses`, `kinds`, `templateIds` (qualquer um dentro de cada lista), `viewed` e `hasOpportunity`; `search` procura no título e no nome do contato. Ordem por `orderBy` (`createdAt` padrão, `viewedAt`, `title`) e `orderByMode`. Sem a migration do banco devolve a lista vazia.

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

## Entrada

| Campo | Tipo | Obrigatório | Nota |
|---|---|---|---|
| `page` | integer | não | padrão 1 |
| `perPage` | integer | não | padrão 20 |
| `orderBy` | "createdAt" \| "viewedAt" \| "title" | não | padrão "createdAt" |
| `orderByMode` | "asc" \| "desc" | não | padrão "desc" |
| `search` | string | não |  |
| `statuses` | "draft" \| "sent" \| "viewed" \| "accepted" \| "rejected" \| "expired"[] | não |  |
| `kinds` | "slide_deck" \| "document" \| "pdf"[] | não |  |
| `templateIds` | string (uuid)[] | não |  |
| `viewed` | boolean | não |  |
| `hasOpportunity` | boolean | não |  |

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

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "page": {
      "default": 1,
      "type": "integer",
      "minimum": 1,
      "maximum": 9007199254740991
    },
    "perPage": {
      "default": 20,
      "type": "integer",
      "minimum": 1,
      "maximum": 2000
    },
    "orderBy": {
      "default": "createdAt",
      "type": "string",
      "enum": [
        "createdAt",
        "viewedAt",
        "title"
      ]
    },
    "orderByMode": {
      "default": "desc",
      "type": "string",
      "enum": [
        "asc",
        "desc"
      ]
    },
    "search": {
      "type": "string",
      "maxLength": 100
    },
    "statuses": {
      "maxItems": 6,
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "draft",
          "sent",
          "viewed",
          "accepted",
          "rejected",
          "expired"
        ]
      }
    },
    "kinds": {
      "maxItems": 3,
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "slide_deck",
          "document",
          "pdf"
        ]
      }
    },
    "templateIds": {
      "maxItems": 50,
      "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)$"
      }
    },
    "viewed": {
      "type": "boolean"
    },
    "hasOpportunity": {
      "type": "boolean"
    }
  }
}
```

</details>

## Exemplo

```bash
curl -X POST https://app.atomiks.com.br/api/v1/proposals.list \
  -H "Authorization: Bearer $ATOMIKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"page":1,"perPage":20,"orderBy":"createdAt","orderByMode":"desc","statuses":["sent"]}'
```

CLI:

```bash
node cli/atomiks.mjs proposals.list --json '{"page":1,"perPage":20,"orderBy":"createdAt","orderByMode":"desc","statuses":["sent"]}'
```

MCP: ferramenta `proposals_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"
          },
          "slug": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "slide_deck",
              "document",
              "pdf"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "sent",
              "viewed",
              "accepted",
              "rejected",
              "expired"
            ]
          },
          "coverHtml": {
            "type": [
              "string",
              "null"
            ]
          },
          "templateId": {
            "type": [
              "string",
              "null"
            ]
          },
          "templateName": {
            "type": [
              "string",
              "null"
            ]
          },
          "leadId": {
            "type": [
              "string",
              "null"
            ]
          },
          "leadName": {
            "type": [
              "string",
              "null"
            ]
          },
          "opportunityId": {
            "type": [
              "string",
              "null"
            ]
          },
          "opportunityTitle": {
            "type": [
              "string",
              "null"
            ]
          },
          "opportunityValue": {
            "type": [
              "number",
              "null"
            ]
          },
          "viewedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "slug",
          "title",
          "kind",
          "status",
          "coverHtml",
          "templateId",
          "templateName",
          "leadId",
          "leadName",
          "opportunityId",
          "opportunityTitle",
          "opportunityValue",
          "viewedAt",
          "createdAt"
        ],
        "additionalProperties": false
      }
    },
    "total": {
      "type": "number"
    },
    "pages": {
      "type": "number"
    }
  },
  "required": [
    "items",
    "total",
    "pages"
  ],
  "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).
