> For the complete documentation index, see [llms.txt](https://docs.violet.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.violet.io/prism/payments/payouts/commission-recovery/recovery-cases-api.md).

# Recovery Cases API

List and read retained-commission recovery cases and their allocations: endpoints, parameters, permissions, fields and errors.

Read the recovery cases for your app, with every amount recovered and where it came from. The API is read-only. For how cases work, see [Retained Commission Recovery](https://docs.violet.io/prism/payments/payouts/commission-recovery.md).

| Method | Path                      | Returns                                             |
| ------ | ------------------------- | --------------------------------------------------- |
| `GET`  | `/v1/recovery_cases`      | A page of cases, newest first, without allocations. |
| `GET`  | `/v1/recovery_cases/{id}` | One case, with its allocations.                     |

See the API reference: [List Recovery Cases](https://docs.violet.io/api-reference/payments/recovery-cases/list-recovery-cases.md) and [Get Recovery Case](https://docs.violet.io/api-reference/payments/recovery-cases/get-recovery-case.md).

## Authentication and Access

Send your usual channel headers: `X-Violet-Token`, `X-Violet-App-Secret` and `X-Violet-App-Id`.

* You see only your own app's cases. The token's developer account must own the app in `X-Violet-App-Id`.
* Retailer tokens are refused.
* A case that belongs to another app returns `404`, exactly as a case that does not exist.

## List Cases

```
GET /v1/recovery_cases
```

| Query parameter | Type    | Default       | Notes                                                                   |
| --------------- | ------- | ------------- | ----------------------------------------------------------------------- |
| `app_id`        | integer | your app      | If sent, it must be the app in `X-Violet-App-Id`.                       |
| `merchant_id`   | integer | all retailers | The retailer must be connected to your app.                             |
| `status`        | string  | all           | `OPENED`, `RECOVERING`, `RECOVERED` or `EXHAUSTED`. Not case-sensitive. |
| `page`          | integer | 1             | 1-based. A page past the end returns an empty `content` list.           |
| `size`          | integer | 20            | 1 to 100. Values outside the range are clamped.                         |

Cases are sorted newest first.

{% tabs %}
{% tab title="cURL" %}

```bash
curl "https://sandbox-api.violet.io/v1/recovery_cases?status=EXHAUSTED&size=50" \
  -H "X-Violet-Token: $VIOLET_TOKEN" \
  -H "X-Violet-App-Secret: $VIOLET_APP_SECRET" \
  -H "X-Violet-App-Id: 10001"
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const params = new URLSearchParams({ status: "EXHAUSTED", size: "50" });
const res = await fetch(`https://sandbox-api.violet.io/v1/recovery_cases?${params}`, {
  headers: {
    "X-Violet-Token": process.env.VIOLET_TOKEN,
    "X-Violet-App-Secret": process.env.VIOLET_APP_SECRET,
    "X-Violet-App-Id": "10001",
  },
});
const page = await res.json();
for (const c of page.content) {
  console.log(c.id, c.merchant_id, c.remaining_gap, c.exhausted_reason);
}
```

{% endtab %}

{% tab title="Python" %}

```python
import os
import requests

res = requests.get(
    "https://sandbox-api.violet.io/v1/recovery_cases",
    params={"status": "EXHAUSTED", "size": 50},
    headers={
        "X-Violet-Token": os.environ["VIOLET_TOKEN"],
        "X-Violet-App-Secret": os.environ["VIOLET_APP_SECRET"],
        "X-Violet-App-Id": "10001",
    },
)
res.raise_for_status()
for case in res.json()["content"]:
    print(case["id"], case["merchant_id"], case["remaining_gap"], case["exhausted_reason"])
```

{% endtab %}
{% endtabs %}

The response is a page object. `content` holds the cases, `total_elements` the number of matching cases, and `size` the page size. `number` is the page index counted **from zero**, so `?page=1` returns `"number": 0`.

## Get a Case

```
GET /v1/recovery_cases/{id}
```

```json
{
  "id": 401,
  "recovery_case_id": 401,
  "refund_id": 30501,
  "order_id": 90001,
  "bag_id": 70001,
  "merchant_id": 5123,
  "payout_account_id": 9123,
  "currency": "USD",
  "gap_amount": 1500,
  "shortfall_amount": 0,
  "shortfall_unknown": false,
  "amount_to_recover": 11800,
  "amount_recovered": 11800,
  "remaining_gap": 0,
  "gap_amount_usd": 1500,
  "shortfall_amount_usd": 0,
  "amount_to_recover_usd": 11800,
  "status": "RECOVERED",
  "escalation": null,
  "exhausted_reason": null,
  "transfer_reversal_ids": [88120, 88131],
  "date_created": "2026-10-15T09:20:41.000+00:00",
  "date_last_modified": "2026-10-15T09:20:44.000+00:00",
  "allocations": [
    {
      "id": null,
      "recovery_case_id": 401,
      "seq": 0,
      "funding_type": "OWN_TRANSACTION",
      "window": "OWN",
      "status": "EXECUTED",
      "amount": 10300,
      "currency": "USD",
      "stripe_transfer_reversal_id": "trr_1Q9a…",
      "stripe_transfer_id": "tr_1Q2b…",
      "funding_payout_transfer_id": 181365,
      "donor_order_id": 90001,
      "donor_bag_id": 70001,
      "failure_reason": null,
      "date_created": "2026-10-15T09:20:41.000+00:00",
      "date_last_modified": "2026-10-15T09:20:44.000+00:00"
    },
    {
      "id": 7,
      "recovery_case_id": 401,
      "seq": 1,
      "funding_type": "BORROWED_REVERSAL",
      "window": "IN_WINDOW",
      "status": "EXECUTED",
      "amount": 1500,
      "currency": "USD",
      "stripe_transfer_reversal_id": "trr_1Q9c…",
      "stripe_transfer_id": "tr_1PxD…",
      "funding_payout_transfer_id": 176002,
      "donor_order_id": 88310,
      "donor_bag_id": 69120,
      "failure_reason": null,
      "date_created": "2026-10-15T09:20:42.000+00:00",
      "date_last_modified": "2026-10-15T09:20:44.000+00:00"
    }
  ]
}
```

## Case Fields

Every field is always present, and is `null` when it has no value. Amounts are integers in minor units (cents) of `currency`.

| Field                                                             | Type              | Description                                                                                                                                                                                                                                                                    |
| ----------------------------------------------------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `id`                                                              | integer           | The recovery case ID. Also the join key between Violet's records and yours.                                                                                                                                                                                                    |
| `recovery_case_id`                                                | integer           | Same as `id`, matching the webhook payload.                                                                                                                                                                                                                                    |
| `refund_id`                                                       | integer           | The Violet refund that opened the case.                                                                                                                                                                                                                                        |
| `order_id`, `bag_id`                                              | integer           | The refunded order and bag.                                                                                                                                                                                                                                                    |
| `merchant_id`                                                     | integer           | The retailer that owes the amount.                                                                                                                                                                                                                                             |
| `payout_account_id`                                               | integer           | The retailer's payout account for the refunded sale.                                                                                                                                                                                                                           |
| `currency`                                                        | string            | The case currency: the currency of the Stripe account the order was paid through. A case that is `EXHAUSTED` with `CURRENCY_UNKNOWN` is in the refunded bag's currency instead. See [Currency](https://docs.violet.io/prism/payments/payouts/commission-recovery.md#currency). |
| `gap_amount`                                                      | integer           | The commission you kept on this refund.                                                                                                                                                                                                                                        |
| `shortfall_amount`                                                | integer           | Any shortfall on the sale's own reversal. Usually 0.                                                                                                                                                                                                                           |
| `shortfall_unknown`                                               | boolean           | `true` when the shortfall could not be measured.                                                                                                                                                                                                                               |
| `amount_to_recover`                                               | integer           | What the sale's own reversal returned, plus `gap_amount`, plus `shortfall_amount`.                                                                                                                                                                                             |
| `amount_recovered`                                                | integer           | The sale's own reversal plus every executed draw. Equals the sum of the allocations whose `status` is `EXECUTED`.                                                                                                                                                              |
| `remaining_gap`                                                   | integer           | `amount_to_recover − amount_recovered`. Zero or less means nothing is owed.                                                                                                                                                                                                    |
| `gap_amount_usd`, `shortfall_amount_usd`, `amount_to_recover_usd` | integer           | The same amounts in US cents, at rates fixed when the case opened. `null` when a rate was not available.                                                                                                                                                                       |
| `status`                                                          | string            | `OPENED`, `RECOVERING`, `RECOVERED` or `EXHAUSTED`.                                                                                                                                                                                                                            |
| `escalation`                                                      | string            | `RUNGS_1_2_EXHAUSTED` when the case is `EXHAUSTED`, otherwise `null`.                                                                                                                                                                                                          |
| `exhausted_reason`                                                | string            | `NO_DONOR_HEADROOM`, `TRANSFER_METHOD_NOT_AUTOMATIC`, `CURRENCY_UNKNOWN` or `SHORTFALL_UNKNOWN` when exhausted, otherwise `null`. See [Exhausted cases](https://docs.violet.io/prism/payments/payouts/commission-recovery.md#exhausted-cases).                                 |
| `transfer_reversal_ids`                                           | array of integers | Violet [Transfer Reversal](https://docs.violet.io/prism/payments/payments-during-checkout/transfer-reversals.md) IDs: the sale's own reversal first, then each executed draw.                                                                                                  |
| `date_created`, `date_last_modified`                              | string            | ISO 8601 timestamps in UTC.                                                                                                                                                                                                                                                    |
| `allocations`                                                     | array             | Single-case response only. Left out of list results.                                                                                                                                                                                                                           |

## Allocation Fields

An allocation is one amount recovered for the case, from one sale. `seq` 0 is the refund's own reversal of the sale's transfer; it is not a draw Violet made for the case, so its `id` is `null`. Draws start at `seq` 1. When a draw reverses a transfer that paid for several sales, it is listed as one allocation per sale, all with the same `seq` and the same Stripe reversal.

| Field                                | Type    | Description                                                                                                                         |
| ------------------------------------ | ------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| `id`                                 | integer | The allocation ID. `null` for `seq` 0.                                                                                              |
| `recovery_case_id`                   | integer | The case.                                                                                                                           |
| `seq`                                | integer | Order within the case.                                                                                                              |
| `funding_type`                       | string  | `OWN_TRANSACTION` (the sale's own transfer) or `BORROWED_REVERSAL` (another of the retailer's transfers).                           |
| `window`                             | string  | `OWN`, `IN_WINDOW` (a sale in the 120 days before the case opened) or `BEYOND_WINDOW`.                                              |
| `status`                             | string  | `EXECUTED` or `FAILED`. A draw still in progress is not listed and does not count in `amount_recovered`.                            |
| `amount`                             | integer | Amount recovered by this allocation.                                                                                                |
| `currency`                           | string  | Currency of `amount`.                                                                                                               |
| `stripe_transfer_reversal_id`        | string  | The Stripe transfer reversal (`trr_…`).                                                                                             |
| `stripe_transfer_id`                 | string  | The Stripe transfer drawn on (`tr_…`).                                                                                              |
| `funding_payout_transfer_id`         | integer | The Violet [Transfer](https://docs.violet.io/prism/payments/payments-during-checkout/transfers.md) drawn on.                        |
| `donor_order_id`, `donor_bag_id`     | integer | The order and bag the amount came from. For `seq` 0 and other draws on the sale's own transfer, this is the refunded order and bag. |
| `failure_reason`                     | string  | Set only when `status` is `FAILED`.                                                                                                 |
| `date_created`, `date_last_modified` | string  | ISO 8601 timestamps in UTC. For `seq` 0, the case's own dates.                                                                      |

## Errors

| Status | Error                      | When                                                                                                                                               |
| ------ | -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| 400    | `invalid_parameter`        | `status` is not one of the four values.                                                                                                            |
| 400    | `missing_parameter`        | A required parameter is missing.                                                                                                                   |
| 403    | `insufficient_permissions` | A retailer token or no token; `app_id` is not your app; the token's developer does not own the app; or `merchant_id` is not connected to your app. |
| 404    | `recovery_case_not_found`  | The case does not exist or belongs to another app.                                                                                                 |

## Notes

* The API can list a case shortly before its `RECOVERY_CASE_OPENED` webhook arrives, for example while Violet waits for the shopper's refund to be confirmed.
* The amounts on a case are read fresh from its allocations each time, so a case read straight after a webhook may already show a later draw.

## Related

* [Retained Commission Recovery](https://docs.violet.io/prism/payments/payouts/commission-recovery.md)
* [Recovery Case Webhooks](https://docs.violet.io/prism/webhooks/events/recovery-case-webhooks.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.violet.io/prism/payments/payouts/commission-recovery/recovery-cases-api.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
