# Error Handling

Errors follow [RFC 9457 Problem Details](https://www.rfc-editor.org/rfc/rfc9457.html) (the successor to RFC 7807) and include a `code` field for programmatic error identification.

### Example Error Response


```json
{
  "type": "https://docs.ripple.com/products/stablecoin",
  "title": "Not Found",
  "status": 404,
  "code": "TRANSACTION_NOT_FOUND"
}
```

## HTTP Status Codes

| HTTP Status | Description |
|  --- | --- |
| `400 Bad Request` | Invalid request parameters or body |
| `401 Unauthorized` | Missing or expired access token |
| `403 Forbidden` | Insufficient scope for the requested operation |
| `404 Not Found` | Resource does not exist |
| `409 Conflict` | Invalid state transition |
| `500 Internal Server Error` | Server error; contact support if persistent |


## Error Codes

| Code | HTTP Status | Description |
|  --- | --- | --- |
| `TRANSACTION_NOT_FOUND` | 404 | Transaction ID not found |
| `TRANSACTION_INVALID_STATUS_TRANSITION` | 409 | Cannot update a transaction that is not in `PENDING` status (e.g., approving an already `PROCESSING` or `COMPLETED` transaction) |
| `TRANSACTION_DESTINATION_TYPE_IMMUTABLE` | 409 | A destination has already been chosen for this pending redemption and cannot be changed. Submitting the *same* destination again is idempotent and returns `200 OK`; only a *different* destination produces this error |
| `INVALID_REQUEST_BODY` | 400 | Malformed or invalid request body (e.g., `walletId` provided when `type` is `FIAT`, or missing `walletId` when `type` is `CRYPTO`) |
| `UNKNOWN_EXCEPTION` | 500 | Unexpected server error |