> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lerian.studio/llms.txt
> Use this file to discover all available pages before exploring further.

# Report a fraud and recover funds

> Open a MED funds recovery at DICT for a Pix your customer paid in a fraud, follow it, and request the refund, with Pix Lerian and Lerian SPI.

Report a Pix that your customer paid in a fraud, and ask DICT to recover the funds.

> [!NOTE]
>
> This flow is a suggested reading of the BACEN manuals for Pix. The manuals prevail over this page. Your institution, as the participant, validates the flow and implements it on the Lerian APIs. See [how to read the diagrams](https://docs.lerian.studio/en/diagrams/introduction.md).

## Participants

***

* **Your institution.** The Pix participant of the paying customer. It opens the recovery and follows it.
* **Pix Lerian.** Keeps the recovery and publishes each change.
* **Lerian SPI.** Exchanges the recovery with DICT and reads its changes from DICT.
* **DICT.** The BACEN directory. It traces the funds and runs the recovery with the receiving participants.

## Before you start

***

* The Pix left an account of your institution in the last 80 days. Keep its end-to-end ID.
* Your systems receive the Pix Lerian events. See [Pix Lerian events](https://docs.lerian.studio/en/interfaces/pix-lerian/pix-lerian-events.md).

## Diagram

***

### Open the recovery

![Report a fraud and recover funds: Open the recovery](https://mintcdn.com/lerian-49cb71fc/qgZtW0Vn3HlCLdfR/images/en/d2/id-report-a-fraud-and-recover-funds-1.svg?fit=max\&auto=format\&n=qgZtW0Vn3HlCLdfR\&q=85\&s=ddc1da4c397988a105605c20f5060257)

| # | From | To | Message | Lerian API | What happens |
| - | - | - | - | - | - |
| 1 | Your institution | Pix Lerian | Lerian API | [`POST /dict/funds-recoveries`](https://docs.lerian.studio/en/reference/interfaces/pix-lerian/dict/create-funds-recovery) | Open the recovery with the account, the end-to-end ID of the Pix in `rootTransactionId`, the `situationType`, and the contact of your customer. Send the `X-Idempotency` header. |
| 2 | Pix Lerian | Lerian SPI | Internal call | | Pix Lerian sends the recovery to Lerian SPI. |
| 3 | Lerian SPI | DICT | DICT API | | Lerian SPI opens the recovery at DICT. |
| 4 | Pix Lerian | Your institution | Lerian API | Response to step 1 | Pix Lerian answers `201` with the recovery in `CREATED`. A `202` means that DICT did not confirm it yet: the recovery is `PENDING`. |
| 5 | DICT | DICT | Internal step | | DICT traces where the funds went, and opens the infraction reports of the recovery. |
| 6 | Lerian SPI | DICT | DICT API | | Lerian SPI reads the changes of the recovery. |
| 7 | Lerian SPI | Pix Lerian | Internal call | | Lerian SPI passes each change to Pix Lerian. |
| 8 | Pix Lerian | Your institution | Lerian API | Event `funds_recovery.updated` | The recovery changed status, for example to `TRACKED` or `ANALYSED`. |
| 9 | Your institution | Pix Lerian | Lerian API | [`GET /dict/funds-recoveries/{id}/tracking-graph`](https://docs.lerian.studio/en/reference/interfaces/pix-lerian/dict/get-funds-recovery-tracking-graph) | Read where the funds went. |
| 10 | Your institution | Pix Lerian | Lerian API | [`GET /dict/funds-recoveries/{id}/infraction-reports`](https://docs.lerian.studio/en/reference/interfaces/pix-lerian/dict/list-funds-recovery-infraction-reports) | Read the infraction reports of the recovery. |

### Request the refund

![Report a fraud and recover funds: Request the refund](https://mintcdn.com/lerian-49cb71fc/qgZtW0Vn3HlCLdfR/images/en/d2/id-report-a-fraud-and-recover-funds-2.svg?fit=max\&auto=format\&n=qgZtW0Vn3HlCLdfR\&q=85\&s=fd6b3f2d9c5907af71e27c690be28d5f)

| # | From | To | Message | Lerian API | What happens |
| - | - | - | - | - | - |
| 1 | Your institution | Pix Lerian | Lerian API | [`POST /dict/funds-recoveries/{id}/refund`](https://docs.lerian.studio/en/reference/interfaces/pix-lerian/dict/refund-funds-recovery) | Request the refund of a recovery in `ANALYSED`. Send the `X-Idempotency` header. |
| 2 | Pix Lerian | Lerian SPI | Internal call | | Pix Lerian sends the refund request to Lerian SPI. |
| 3 | Lerian SPI | DICT | DICT API | | Lerian SPI sends the refund request to DICT. |
| 4 | Pix Lerian | Your institution | Lerian API | Response to step 1 | Pix Lerian answers `200` with the recovery in `REFUNDING`. |
| 5 | Lerian SPI | DICT | DICT API | | Lerian SPI reads the changes of the recovery. |
| 6 | Lerian SPI | Pix Lerian | Internal call | | Lerian SPI passes each change to Pix Lerian. |
| 7 | Pix Lerian | Your institution | Lerian API | Event `funds_recovery.updated` | The recovery is `COMPLETED`. |

## Rules

***

* `situationType` is one of `SCAM`, `ACCOUNT_TAKEOVER`, `COERCION`, `FRAUDULENT_ACCESS`, `OTHER` or `UNKNOWN`. With `OTHER`, describe the case in `reportDetails`.
* A Pix takes one recovery. A cancelled recovery also counts.
* A recovery is a case at DICT. Its status alone does not show that funds came back.
* To stop a recovery, cancel it with [`POST /dict/funds-recoveries/{id}/cancel`](https://docs.lerian.studio/en/reference/interfaces/pix-lerian/dict/cancel-funds-recovery).

## How you know it finished

***

Pix Lerian publishes `funds_recovery.updated`, and [`GET /dict/funds-recoveries/{id}`](https://docs.lerian.studio/en/reference/interfaces/pix-lerian/dict/get-funds-recovery) shows the recovery in `COMPLETED`.

## What can go wrong

***

| Situation | What you see | What to do |
| - | - | - |
| The Pix already has a recovery. | `409`, code `PIX-0113`. | Follow the recovery that exists. |
| The Pix is older than the DICT time limit. | `422`, code `PIX-0117`. | DICT does not take the recovery. |
| DICT did not resolve the operation yet. | `409`, code `PIX-0118`. | Keep the `operationId`. Read the recovery later. Do not send a new request. |
| The recovery is not in `ANALYSED`. | `409`, code `PIX-0114`. | Wait for `funds_recovery.updated` with `ANALYSED`. |
| The answer to a request does not arrive. | No answer, or a timeout. | Send the same request again with the same `X-Idempotency` key. |

The [Pix Lerian error list](https://docs.lerian.studio/en/reference/interfaces/pix-lerian/pix-lerian-error-list.md) describes each code.

## Related

***

* [Return a received Pix](https://docs.lerian.studio/en/diagrams/native-rails/return-a-received-pix.md)
* [Use DICT with Pix Lerian](https://docs.lerian.studio/en/interfaces/pix-lerian/pix-lerian-dict.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.