# MED Details

Queries the complete details of a specific MED (Special Refund Mechanism) process.

## Endpoint

```
GET /api/external/med/:id
```

## Headers

| Header | Type | Required | Description |
|--------|------|----------|-------------|
| `Authorization` | String | Yes | `ApiKey {client_id}:{client_secret}` |
| `X-Key-Case` | String | No | Set to `camelCase` to receive response fields in camelCase (default is snake_case) |

## Path Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `id` | String | Yes | MED process identifier |

## Example

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

## Success Response (200)

```json
{
  "worked": true,
  "med": {
    "id": "MED20260307001",
    "type": "REFUND_REQUEST",
    "status": "ACKNOWLEDGED",
    "amount": 50000,
    "original_end_to_end_id": "E46026562202603071530000001",
    "reason": "Fraude reportada pelo pagador",
    "created_at": "2026-03-07T18:00:00Z"
  }
}
```

::: tip Status in UPPERCASE
Possible values: `ACKNOWLEDGED`, `CLOSED`, `CANCELLED`. Passed through as received from the PIX provider (PIX/BACEN) - no normalization. See [med-list](/en/med-list#med-status) for details.
:::

| Field | Type | Description |
|-------|------|-------------|
| `worked` | Boolean | `true` indicates operation success |
| `med.id` | String | Unique MED identifier |
| `med.type` | String | Type: `REFUND_REQUEST` or `REFUND_CANCELLED` |
| `med.status` | String | Current process status (`ACKNOWLEDGED`, `CLOSED`, `CANCELLED`) |
| `med.amount` | Integer | Value in **base units** (÷ 10,000 for BRL). `50000` = R$ 5.00 |
| `med.original_end_to_end_id` | String | E2E of the original PIX transaction. Use to cross-reference with `GET /transactions/ref/:external_id` |
| `med.reason` | String | Reason provided by the requester (free text). `null` if not available |
| `med.created_at` | String | Opening date (ISO 8601 UTC) |

::: info Additional fields not exposed via External API
The PIX/BACEN provider returns more fields than those exposed by this endpoint. Fields deliberately filtered in the serializer include:

| Field (provider) | Description | Where to get it today |
|---|---|---|
| `analysisResult` | Final decision: `AGREED` or `DISAGREED` | Webhook [`pix.infraction.resolved`](/en/webhooks-payloads#pix-infraction-resolved) |
| `analysisDetails` | Justification of the decision | Webhook [`pix.infraction.resolved`](/en/webhooks-payloads#pix-infraction-resolved) |
| `infractionType` | `REFUND_REQUEST` or `REFUND_CANCELLED` | Already exposed in `med.type` |
| `fraudType` | `SCAM`, `ACCOUNT_TAKEOVER`, `COERCION`, `FRAUDULENT_ACCESS`, `OTHER` | Webhook `pix.refund.requested` (field `fraud_category`) |
| `situationType` | Type of situation involved (BACEN taxonomy) | Shown in the portal when applicable |
| `defenseDeadline` | BACEN deadline for defense submission | Webhook [`pix.infraction.created`](/en/webhooks-payloads#pix-infraction-created) |

For programmatic integration, use the webhooks listed on this page and the public MED query and defense endpoints.

See [Infractions (full flow)](/en/infractions) to understand the relationship between MED and Infractions.
:::

::: warning Value in subcentavos, not in BRL
The `amount` field is in **subcentavos** (1 BRL = 10,000 subcentavos). Value `50000` = R$ 5.00 - **not** R$ 50,000. Never multiply by 100 or use float.
:::

## Error Response (404)

```json
{
  "worked": false,
  "errors": {
    "not_found": "MED não encontrado"
  }
}
```

::: info 404 may indicate a transient error
If the MED exists in another channel (webhook, previous listing) but returns 404 in this query, it may be a transient PIX provider failure. Try again in a few seconds. If it persists after 5 min, contact support.

The backend converts all provider errors (including timeouts and network errors) into HTTP 404 with `detail: "MED nao encontrado"`. To distinguish "does not exist" from "transient failure", first check the [List MED](/en/med-list) endpoint - if the ID appears in the list but the detail returns 404, it is transient.
:::

## Error Response (401)

```json
{
  "worked": false,
  "errors": {
    "unauthorized": "Missing API key credentials. Use Authorization: ApiKey <client_id>:<client_secret>"
  }
}
```

::: tip Real-time tracking (webhooks)
The `pix.refund.requested` and `pix.refund.completed` webhook events **ARE dispatched automatically** by the backend as of April 2026. It is recommended to subscribe to these webhooks to avoid depending on polling. Polling on `GET /med/:id` or `GET /med` continues to work as an alternative.
:::
