# Error Handling

Errors follow [RFC 7807 Problem Details](https://datatracker.ietf.org/doc/html/rfc7807) 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) |
| `INVALID_REQUEST_BODY` | 400 | Malformed or invalid request body (e.g., `walletId` provided with `FIAT` destination, or missing `walletId` with `CRYPTO` destination) |
| `UNKNOWN_EXCEPTION` | 500 | Unexpected server error |