# sales_recovery.overview

Cartões da recuperação de vendas. Valor total e itens para recuperação (várias tentativas do mesmo comprador na mesma oferta contam uma vez) e, por tipo, a quantidade e o valor: carrinho abandonado, Pix e boleto em aberto, recusados, vendas canceladas e reembolsos. Os motivos (`*ReasonBreakdown`) e a etapa do abandono vêm vazios nas plataformas.

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

## Entrada

| Campo | Tipo | Obrigatório | Nota |
|---|---|---|---|
| `filters` | object | 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
        }
      }
    }
  }
}
```

</details>

## Exemplo

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

CLI:

```bash
node cli/atomiks.mjs sales_recovery.overview --json '{}'
```

MCP: ferramenta `sales_recovery_overview` 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": {
    "recovery": {
      "type": "object",
      "properties": {
        "totalValue": {
          "type": "number"
        },
        "totalItems": {
          "type": "number"
        },
        "cartAbandonment": {
          "type": "object",
          "properties": {
            "count": {
              "type": "number"
            },
            "value": {
              "type": "number"
            }
          },
          "required": [
            "count",
            "value"
          ],
          "additionalProperties": false
        },
        "pixPending": {
          "type": "object",
          "properties": {
            "count": {
              "type": "number"
            },
            "value": {
              "type": "number"
            }
          },
          "required": [
            "count",
            "value"
          ],
          "additionalProperties": false
        },
        "boletoPending": {
          "type": "object",
          "properties": {
            "count": {
              "type": "number"
            },
            "value": {
              "type": "number"
            }
          },
          "required": [
            "count",
            "value"
          ],
          "additionalProperties": false
        },
        "failed": {
          "type": "object",
          "properties": {
            "count": {
              "type": "number"
            },
            "value": {
              "type": "number"
            }
          },
          "required": [
            "count",
            "value"
          ],
          "additionalProperties": false
        },
        "canceled": {
          "type": "object",
          "properties": {
            "count": {
              "type": "number"
            },
            "value": {
              "type": "number"
            }
          },
          "required": [
            "count",
            "value"
          ],
          "additionalProperties": false
        },
        "refunded": {
          "type": "object",
          "properties": {
            "count": {
              "type": "number"
            },
            "value": {
              "type": "number"
            }
          },
          "required": [
            "count",
            "value"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "totalValue",
        "totalItems",
        "cartAbandonment",
        "pixPending",
        "boletoPending",
        "failed",
        "canceled",
        "refunded"
      ],
      "additionalProperties": false
    },
    "failedReasonBreakdown": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string"
          },
          "count": {
            "type": "number"
          }
        },
        "required": [
          "reason",
          "count"
        ],
        "additionalProperties": false
      }
    },
    "canceledReasonBreakdown": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string"
          },
          "count": {
            "type": "number"
          }
        },
        "required": [
          "reason",
          "count"
        ],
        "additionalProperties": false
      }
    },
    "refundedReasonBreakdown": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string"
          },
          "count": {
            "type": "number"
          }
        },
        "required": [
          "reason",
          "count"
        ],
        "additionalProperties": false
      }
    },
    "cartAbandonmentStageBreakdown": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "stage": {
            "type": "string"
          },
          "count": {
            "type": "number"
          }
        },
        "required": [
          "stage",
          "count"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "recovery",
    "failedReasonBreakdown",
    "canceledReasonBreakdown",
    "refundedReasonBreakdown",
    "cartAbandonmentStageBreakdown"
  ],
  "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).
