# sales.external_list

Listar vendas de plataformas externas. Último estado de cada pedido recebido por integração (Hotmart, Kiwify...), com comprador, produto, código da oferta, valor, moeda, gateway, método e referência. `column`: value, createdAt, updatedAt, productName, method, leadName, installments, gatewayOrigin ou offerCode.

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

## Entrada

| Campo | Tipo | Obrigatório | Nota |
|---|---|---|---|
| `filters` | object | não |  |
| `page` | integer | não |  |
| `perPage` | integer | não |  |
| `column` | "value" \| "createdAt" \| "updatedAt" \| "productName" \| "method" \| "leadName" \| "installments" \| "gatewayOrigin" \| "offerCode" | não |  |
| `order` | "asc" \| "desc" | não |  |

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

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "filters": {
      "type": "object",
      "properties": {
        "transactionPeriod": {
          "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)))$"
            }
          }
        },
        "searchText": {
          "type": "string",
          "maxLength": 200
        },
        "contactName": {
          "type": "string",
          "maxLength": 200
        },
        "contactEmail": {
          "type": "string",
          "maxLength": 200
        },
        "contactDocument": {
          "type": "string",
          "maxLength": 200
        },
        "transactionShortenId": {
          "type": "string",
          "maxLength": 200
        },
        "externalId": {
          "type": "string",
          "maxLength": 200
        },
        "contactTags": {
          "maxItems": 200,
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 120
          }
        },
        "utmSource": {
          "maxItems": 200,
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 120
          }
        },
        "utmMedium": {
          "maxItems": 200,
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 120
          }
        },
        "utmCampaign": {
          "maxItems": 200,
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 120
          }
        },
        "utmTerm": {
          "maxItems": 200,
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 120
          }
        },
        "utmContent": {
          "maxItems": 200,
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 120
          }
        },
        "src": {
          "maxItems": 200,
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 120
          }
        },
        "sck": {
          "maxItems": 200,
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 120
          }
        },
        "transactionStatus": {
          "maxItems": 10,
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "pending",
              "paid",
              "canceled",
              "refunded",
              "chargedBack",
              "failed"
            ]
          }
        },
        "projectIds": {
          "maxItems": 200,
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 120
          }
        },
        "funnelIds": {
          "maxItems": 200,
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 120
          }
        },
        "productIds": {
          "maxItems": 200,
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 120
          }
        },
        "offerIds": {
          "maxItems": 200,
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 120
          }
        },
        "orderBumpOfferIds": {
          "maxItems": 200,
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 120
          }
        },
        "excludeOrderBumpOfferIds": {
          "maxItems": 200,
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 120
          }
        },
        "transactionRecurrence": {
          "type": "string",
          "enum": [
            "OneTime",
            "Recurrent",
            "Trial"
          ]
        },
        "saleKind": {
          "type": "string",
          "enum": [
            "new",
            "invoice"
          ]
        },
        "currency": {
          "maxItems": 10,
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 3
          }
        },
        "valueOfLastPurchase": {
          "type": "object",
          "properties": {
            "min": {
              "type": "number",
              "minimum": 0,
              "maximum": 100000
            },
            "max": {
              "type": "number",
              "minimum": 0,
              "maximum": 100000
            }
          }
        },
        "transactionType": {
          "maxItems": 3,
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "credit",
              "pix",
              "boleto"
            ]
          }
        },
        "suspectedFraudOnly": {
          "type": "boolean"
        },
        "couponCode": {
          "type": "string",
          "maxLength": 200
        },
        "externalPageUrl": {
          "type": "string",
          "maxLength": 200
        },
        "gatewayOrigin": {
          "type": "string",
          "maxLength": 200
        },
        "productName": {
          "type": "string",
          "maxLength": 200
        },
        "offerCode": {
          "type": "string",
          "maxLength": 200
        },
        "installments": {
          "type": "integer",
          "minimum": 0,
          "maximum": 100
        }
      }
    },
    "page": {
      "type": "integer",
      "minimum": 1,
      "maximum": 100000
    },
    "perPage": {
      "type": "integer",
      "minimum": 1,
      "maximum": 100
    },
    "column": {
      "type": "string",
      "enum": [
        "value",
        "createdAt",
        "updatedAt",
        "productName",
        "method",
        "leadName",
        "installments",
        "gatewayOrigin",
        "offerCode"
      ]
    },
    "order": {
      "type": "string",
      "enum": [
        "asc",
        "desc"
      ]
    }
  }
}
```

</details>

## Exemplo

```bash
curl -X POST https://app.atomiks.com.br/api/v1/sales.external_list \
  -H "Authorization: Bearer $ATOMIKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"page":1,"perPage":50}'
```

CLI:

```bash
node cli/atomiks.mjs sales.external_list --json '{"page":1,"perPage":50}'
```

MCP: ferramenta `sales_external_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": {
    "data": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "status": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "pending",
                  "paid",
                  "canceled",
                  "refunded",
                  "chargedBack",
                  "failed"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "lead": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "name": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "email": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "origin": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "id",
                  "name",
                  "email",
                  "origin"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "shortenId": {
            "type": [
              "string",
              "null"
            ]
          },
          "productName": {
            "type": [
              "string",
              "null"
            ]
          },
          "offerCode": {
            "type": [
              "string",
              "null"
            ]
          },
          "value": {
            "type": [
              "number",
              "null"
            ]
          },
          "currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "gatewayOrigin": {
            "type": [
              "string",
              "null"
            ]
          },
          "method": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "credit",
                  "pix",
                  "boleto"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "externalId": {
            "type": [
              "string",
              "null"
            ]
          },
          "externalPageUrl": {
            "type": [
              "string",
              "null"
            ]
          },
          "page": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "name": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "installments": {
            "type": [
              "number",
              "null"
            ]
          },
          "couponCode": {
            "type": [
              "string",
              "null"
            ]
          },
          "orderBumps": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                }
              },
              "required": [
                "name"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "id",
          "createdAt",
          "status",
          "lead",
          "shortenId",
          "productName",
          "offerCode",
          "value",
          "currency",
          "gatewayOrigin",
          "method",
          "externalId",
          "externalPageUrl",
          "page",
          "installments",
          "couponCode",
          "orderBumps"
        ],
        "additionalProperties": false
      }
    },
    "meta": {
      "type": "object",
      "properties": {
        "page": {
          "type": "number"
        },
        "perPage": {
          "type": "number"
        },
        "countItens": {
          "type": "number"
        },
        "countPages": {
          "type": "number"
        }
      },
      "required": [
        "page",
        "perPage",
        "countItens",
        "countPages"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "data",
    "meta"
  ],
  "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).
