# Query Cash-Out by E2E ID

Queries a PIX transaction by End-to-End ID, the unique identifier assigned by BACEN in the Instant Payment System (SPI).

## Endpoint

```
GET /api/external/transactions/e2e/:e2e_id
```

## Headers

| Header | Type | Required | Description |
|--------|------|----------|-------------|
| `Authorization` | String | Yes | `ApiKey {client_id}:{client_secret}` |

## Path Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `e2e_id` | String | Yes | End-to-End ID (format: `E{ISPB}{YYYYMMDDHHmm}{sequential}`) |

::: tip E2E ID format
The End-to-End ID follows the BACEN standard: `E` + ISPB (8 digits) + date/time (12 digits) + sequential. Example: `E46026562202603091530abcdef01`. The ISPB `46026562` identifies Monetarie.
:::

## Example

```bash
curl -X GET https://api.monetarie.com/api/external/transactions/e2e/E46026562202603091530abcdef01 \
  -H "Authorization: ApiKey $CLIENT_ID:$CLIENT_SECRET"
```

## Success Response -- 200

For a settled transaction (`transactions` table):

```json
{
  "worked": true,
  "data": {
    "id": "c7f3a8b12d4e4f6a9c1b3e5f7a9b1d3e",
    "transaction_id": "PIXOUT20260309a1b2c3d4e5f6",
    "end_to_end_id": "E46026562202603091530abcdef01",
    "external_id": "order-9876",
    "type": "pix",
    "direction": "outbound",
    "status": "settled",
    "amount": 300000,
    "fee_amount": 350,
    "net_amount": 300350,
    "description": "Pagamento fornecedor",
    "counterparty_name": "Joao Silva",
    "recipient_key": "12345678901",
    "payer_document": "46026562000165",
    "recipient_document": "12345678901",
    "payer_ispb": "46026562",
    "payer_bank_name": "Monetarie",
    "created_at": "2026-03-09T15:30:00Z",
    "completed_at": "2026-03-09T15:30:02Z"
  }
}
```

The endpoint `GET /transactions/e2e/:e2e_id` searches in **3 sources** in the following order: (1) settled `transactions`; (2) `outbound_requests` in progress (PIX OUT still processing); (3) rejected `failed_transactions`. **It does not search in `qrcodes`** - to locate QRs use `GET /transactions/:id` with the QR `tx_id`, or `GET /transactions/ref/:external_id` with the `external_id` you assigned at creation.

The response structure varies by the source matched - there are **3 distinct shapes**:

- **Settled transaction** (`transactions` via `Helpers.format_external_transaction/1`): shape of the example above, with `status: "settled"`. 18 fields (including `payer_document`, `recipient_document`, `payer_ispb`, `payer_bank_name`, `counterparty_name`). Same shape returned by `GET /transactions/tag/:tag`.
- **PIX OUT in progress** (`outbound_requests`): reduced shape, with `status: "processing"`. Fields: `status`, `transaction_id`, `end_to_end_id`, `amount`, `fee_amount`, `net_amount`, `external_id`, `pix_key`, `description`, `type`, `direction: "outbound"`, `payment_status: "processing"`, `started_at`, `recipient: {name, key, key_type}`. **Does not include** `payer_document`, `payer_ispb`, or `completed_at`.
- **Rejected transaction** (`failed_transactions`): failure shape, with `status: "failed"`. Adds `reason_code` (uppercase BACEN or lowercase provider), `reason_description` (in English), `failure_reason` (raw string), `failed_at`, and simplified `recipient: {name, key}`.

See the full shape and possible values of the `status` field in [Query Cash-Out by ID -- Status field values](/en/pix-cashout-status#status-field-values). The `status` field **does not share a single vocabulary across sources** - `outbound_requests` returns `"processing"` while `transactions` with internal status 2 returns `"pending"`.

::: tip Defensive parser
Always route the parser by `data.status` **before** reading specific fields:

```javascript
switch (data.status) {
  case "settled":    // settled transactions - 18 fields
  case "processing": // PIX OUT in progress - no payer_* nor completed_at
  case "failed":     // rejected - with reason_code / reason_description
  case "pending":    // rare - transactions.status internal 2
}
```
:::

All monetary values in **base units** (÷ 10,000 for BRL). Fields `payer_document`, `recipient_document`, `payer_ispb`, and `payer_bank_name` **appear only in the "settled" shape** - they are resolved from the transaction metadata and may be `null` on old rows or when the counterparty did not send the data.

## Error Response -- 404

```json
{
  "worked": false,
  "detail": "Transacao nao encontrada para E2E ID: E46026562202603091530abcdef01"
}
```
