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

# API Errors

> Understanding and handling MPCVault API errors.

## Error Response Format

All errors return a JSON object with an `error` field:

```json theme={null}
{
  "error": {
    "code": "INVALID_ARGUMENT",
    "message": "vaultUuid is required"
  }
}
```

## Common Error Codes

| Code                  | Description                                   |
| --------------------- | --------------------------------------------- |
| `INVALID_ARGUMENT`    | Missing or invalid request parameters         |
| `NOT_FOUND`           | Resource (wallet, signing request) not found  |
| `PERMISSION_DENIED`   | API token lacks required permissions          |
| `UNAUTHENTICATED`     | Missing or invalid API token                  |
| `ALREADY_EXISTS`      | Resource already exists (e.g., duplicate ref) |
| `FAILED_PRECONDITION` | Operation not allowed in current state        |
| `RESOURCE_EXHAUSTED`  | Rate limit exceeded                           |
| `INTERNAL`            | Internal server error                         |

## HTTP Status Codes

| Status | Meaning                              |
| ------ | ------------------------------------ |
| `200`  | Success                              |
| `400`  | Bad request - check your parameters  |
| `401`  | Unauthorized - check your API token  |
| `403`  | Forbidden - insufficient permissions |
| `404`  | Not found                            |
| `429`  | Rate limited - slow down requests    |
| `500`  | Server error - retry later           |

## Handling Errors

```python theme={null}
import requests

response = requests.post(
    "https://api.mpcvault.com/v1/createWallet",
    headers={"x-mtoken": "YOUR_API_TOKEN"},
    json={"vaultUuid": "..."}
)

if response.status_code != 200:
    error = response.json().get("error", {})
    print(f"Error: {error.get('code')} - {error.get('message')}")
```
