# external_recovery.list

Listar pedidos externos para recuperar. Pedidos de plataformas externas da sub-aba (`failed`: recusados; `chargeback`; `refunded`; `canceled`), mais novos primeiro, com comprador, produto, código da oferta, valor, plataforma e método. `searchText` busca em nome, e-mail, produto, oferta e código.

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

## Entrada

| Campo | Tipo | Obrigatório | Nota |
|---|---|---|---|
| `subTab` | "failed" \| "chargeback" \| "refunded" \| "canceled" | sim |  |
| `searchText` | string | não |  |
| `page` | integer | não |  |
| `perPage` | integer | não |  |

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

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "subTab": {
      "type": "string",
      "enum": [
        "failed",
        "chargeback",
        "refunded",
        "canceled"
      ]
    },
    "searchText": {
      "type": "string",
      "maxLength": 200
    },
    "page": {
      "type": "integer",
      "minimum": 1,
      "maximum": 100000
    },
    "perPage": {
      "type": "integer",
      "minimum": 1,
      "maximum": 100
    }
  },
  "required": [
    "subTab"
  ]
}
```

</details>

## Exemplo

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

CLI:

```bash
node cli/atomiks.mjs external_recovery.list --json '{"subTab":"failed","page":1,"perPage":50}'
```

MCP: ferramenta `external_recovery_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"
          },
          "status": {
            "type": "string",
            "enum": [
              "failed",
              "chargeback",
              "refunded",
              "canceled"
            ]
          },
          "createdAt": {
            "type": "string"
          },
          "lead": {
            "type": "object",
            "properties": {
              "id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "email": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "id",
              "name",
              "email"
            ],
            "additionalProperties": false
          },
          "shortenId": {
            "type": "string"
          },
          "productName": {
            "type": [
              "string",
              "null"
            ]
          },
          "offerCode": {
            "type": [
              "string",
              "null"
            ]
          },
          "value": {
            "type": "number"
          },
          "currency": {
            "type": "string"
          },
          "gatewayOrigin": {
            "type": [
              "string",
              "null"
            ]
          },
          "method": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "credit",
                  "pix",
                  "boleto"
                ]
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "status",
          "createdAt",
          "lead",
          "shortenId",
          "productName",
          "offerCode",
          "value",
          "currency",
          "gatewayOrigin",
          "method"
        ],
        "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).
