# Error Responses

## Error Response Structure

All errors return a unified format:

```json
{
    "code": 40001,
    "message": "Invalid parameter",
    "details": {
        "field": "currency_id",
        "value": "abc",
        "issue": "Invalid format, expected numeric string"
    }
}
```

## Error Code Reference

| Error Code | HTTP Status | Description                     | Example                                    |
| ---------- | ----------- | ------------------------------- | ------------------------------------------ |
| 400001     | 400         | Invalid parameter format        | currency\_id format is incorrect           |
| 400002     | 400         | Missing required parameter      | ticker not provided                        |
| 400003     | 400         | Invalid parameter value         | interval not in enum range                 |
| 400101     | 401         | Invalid API Key                 | Key does not exist or is disabled          |
| 400102     | 401         | API Key expired                 | Re-application required                    |
| 400301     | 403         | Insufficient permissions        | Current Key has no access to this endpoint |
| 400401     | 404         | Resource not found              | currency\_id does not match any currency   |
| 400402     | 404         | Endpoint not found              | URL path is incorrect                      |
| 402901     | 429         | Too many requests               | Rate limit triggered                       |
| 500001     | 500         | Internal server error           | System exception                           |
| 500301     | 503         | Service temporarily unavailable | System maintenance                         |

## Common Error Examples

**Parameter validation failure (400):**

```json
{
    "code": 400001,
    "message": "Invalid parameter: currency_id",
    "details": {
        "field": "currency_id",
        "value": "invalid_id",
        "constraint": "must be numeric string",
        "suggestion": "Use GET /currencies to get valid currency IDs"
    }
}
```

**Authentication failure (401):**

```json
{
    "code": 400101,
    "message": "Invalid API Key",
    "details": {
        "header": "X-API-KEY",
        "solution": "Check your API Key or contact support"
    }
}
```

**Resource not found (404):**

```json
{
    "code": 400401,
    "message": "Currency not found",
    "details": {
        "currency_id": "9999999999999999999",
        "suggestion": "Use GET currencies to list available currencies"
    }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sosovalue-1.gitbook.io/sosovalue-api-doc/error-responses.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
