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

# Error Codes

> Exhaustive list of possible error codes

## Overview

The Rampnow API returns standard HTTP status codes to indicate the success or failure of API requests. These codes are returned by the server and provide immediate feedback about your request.

<Info>
  HTTP status codes are different from application error codes. Status codes indicate the HTTP-level result, while error codes provide specific application-level details.
</Info>

## API Status Code Categories

### 2xx - Success

<AccordionGroup>
  <Accordion title="200 OK" icon="check">
    **Success**

    The request was successful and the server returned the requested data.

    ```json theme={null}
    {
      "code": 0,
      "data": { ... }
    }
    ```
  </Accordion>

  <Accordion title="201 Created" icon="plus">
    **Resource Created**

    The request was successful and a new resource was created.
  </Accordion>

  <Accordion title="204 No Content" icon="circle-check">
    **Success with No Content**

    The request was successful but there is no content to return.
  </Accordion>
</AccordionGroup>

### 4xx - Client Errors

<AccordionGroup>
  <Accordion title="400 Bad Request" icon="circle-xmark">
    **Invalid Request**

    The request is malformed or contains invalid parameters. Check your request payload and parameters.

    **Common causes:**

    * Missing required fields
    * Invalid JSON format
    * Incorrect data types
  </Accordion>

  <Accordion title="401 Unauthorized" icon="lock">
    **Authentication Failed**

    Authentication credentials are missing or invalid.

    **Common causes:**

    * Missing `X-RAMPNOW-API-KEY` header
    * Invalid API key
    * Missing or incorrect signature
    * Expired timestamp
  </Accordion>

  <Accordion title="403 Forbidden" icon="ban">
    **Access Denied**

    You don't have permission to access this resource.

    **Common causes:**

    * Insufficient account permissions
    * API key doesn't have required scope
    * IP address not whitelisted
  </Accordion>

  <Accordion title="404 Not Found" icon="magnifying-glass">
    **Resource Not Found**

    The requested resource doesn't exist.

    **Common causes:**

    * Incorrect endpoint URL
    * Invalid resource ID
    * Resource has been deleted
  </Accordion>

  <Accordion title="422 Unprocessable Entity" icon="triangle-exclamation">
    **Validation Error**

    The request is well-formed but contains semantic errors.

    **Common causes:**

    * Business logic validation failed
    * Invalid currency pair
    * Amount outside allowed range
  </Accordion>

  <Accordion title="429 Too Many Requests" icon="gauge-high">
    **Rate Limit Exceeded**

    You have exceeded the API rate limit.

    **Solution:** Wait before making additional requests. Check the `Retry-After` header for guidance.
  </Accordion>
</AccordionGroup>

### 5xx - Server Errors

<AccordionGroup>
  <Accordion title="500 Internal Server Error" icon="server">
    **Server Error**

    An unexpected error occurred on the server.

    **Action:** Retry the request. If the issue persists, contact support with your request details.
  </Accordion>

  <Accordion title="502 Bad Gateway" icon="network-wired">
    **Bad Gateway**

    The server received an invalid response from an upstream server.

    **Action:** This is usually temporary. Retry the request after a short delay.
  </Accordion>

  <Accordion title="503 Service Unavailable" icon="circle-exclamation">
    **Service Unavailable**

    The service is temporarily unavailable, usually due to maintenance or overload.

    **Action:** Retry the request after some time. Check the `Retry-After` header if provided.
  </Accordion>

  <Accordion title="504 Gateway Timeout" icon="clock">
    **Gateway Timeout**

    The server didn't receive a timely response from an upstream server.

    **Action:** Retry the request. Consider reducing payload size if applicable.
  </Accordion>
</AccordionGroup>

## Status Code Reference Table

| Status Code | Status Text           | Category     | Description                          |
| ----------- | --------------------- | ------------ | ------------------------------------ |
| 200         | OK                    | Success      | Request successful                   |
| 201         | Created               | Success      | Resource created successfully        |
| 204         | No Content            | Success      | Success with no response body        |
| 400         | Bad Request           | Client Error | Invalid request format or parameters |
| 401         | Unauthorized          | Client Error | Authentication required or failed    |
| 403         | Forbidden             | Client Error | Access denied                        |
| 404         | Not Found             | Client Error | Resource not found                   |
| 422         | Unprocessable Entity  | Client Error | Validation error                     |
| 429         | Too Many Requests     | Client Error | Rate limit exceeded                  |
| 500         | Internal Server Error | Server Error | Unexpected server error              |
| 502         | Bad Gateway           | Server Error | Invalid upstream response            |
| 503         | Service Unavailable   | Server Error | Service temporarily unavailable      |
| 504         | Gateway Timeout       | Server Error | Upstream server timeout              |

## API Error Code categories

The Rampnow API uses standardized error codes to indicate the success or failure of requests. All error responses include a numeric code to help you identify and handle specific error conditions.

### Success Response

<ResponseField name="Success" type="number">
  **Code:** `0`

  Request completed successfully.
</ResponseField>

### Client Errors (100000-100019)

<AccordionGroup>
  <Accordion title="NotFoundErr - 100000">
    The requested resource could not be found. Verify the endpoint URL and resource ID.
  </Accordion>

  <Accordion title="NotAuthenticatedErr - 100001">
    Authentication credentials are missing or invalid. Check your API key and signature.
  </Accordion>

  <Accordion title="NotAuthorizedErr - 100002">
    You don't have permission to access this resource. Verify your account permissions.
  </Accordion>

  <Accordion title="InvalidArgsErr - 100004">
    One or more request parameters are invalid. Review the request payload and parameter requirements.
  </Accordion>

  <Accordion title="ConflictErr - 100005">
    The request conflicts with the current state of the resource. Check for duplicate operations.
  </Accordion>

  <Accordion title="ExpiredErr - 100014">
    The request or resource has expired. Generate a new request with updated timestamp.
  </Accordion>

  <Accordion title="InvalidErr - 100015">
    The request contains invalid data. Validate your input against the API specification.
  </Accordion>

  <Accordion title="MfaRequiredErr - 100016">
    Multi-factor authentication is required for this operation.
  </Accordion>

  <Accordion title="RequestErr - 100017">
    The request is malformed or contains errors. Review the request structure.
  </Accordion>

  <Accordion title="BlockedErr - 100018">
    Your account or IP has been blocked. Contact support for assistance.
  </Accordion>

  <Accordion title="BlacklistedErr - 100019">
    The resource or entity is blacklisted and cannot be processed.
  </Accordion>
</AccordionGroup>

### Operational Errors (100020-100023)

<AccordionGroup>
  <Accordion title="RetryExceededErr - 100020">
    Maximum retry attempts exceeded. Wait before retrying the operation.
  </Accordion>

  <Accordion title="NotSupportedErr - 100021">
    The requested operation or feature is not supported.
  </Accordion>

  <Accordion title="MfaSetupRequiredErr - 100022">
    Multi-factor authentication setup is required before proceeding.
  </Accordion>

  <Accordion title="InvalidQuoteErr - 100023">
    The quote provided is invalid or has expired. Request a new quote.
  </Accordion>
</AccordionGroup>

### Server Errors (100024-100032)

<AccordionGroup>
  <Accordion title="ServerErr - 100024">
    An internal server error occurred. Retry the request or contact support if the issue persists.
  </Accordion>

  <Accordion title="RequestTimeoutErr - 100025">
    The request timed out. Retry with a shorter payload or check your connection.
  </Accordion>

  <Accordion title="PayloadSizeErr - 100026">
    Request payload exceeds the maximum allowed size. Reduce the payload size.
  </Accordion>

  <Accordion title="RateLimitErr - 100027">
    Rate limit exceeded. Wait before making additional requests.
  </Accordion>

  <Accordion title="BadGatewayErr - 100028">
    Bad gateway error. The server received an invalid response from an upstream server.
  </Accordion>

  <Accordion title="ServiceUnavailableErr - 100029">
    Service is temporarily unavailable. Retry after some time.
  </Accordion>

  <Accordion title="GatewayTimeoutErr - 100030">
    Gateway timeout. The server did not receive a timely response from an upstream server.
  </Accordion>

  <Accordion title="InvalidMethodErr - 100031">
    HTTP method not allowed for this endpoint. Check the API documentation for allowed methods.
  </Accordion>

  <Accordion title="UnprocessableEntityErr - 100032">
    The request is well-formed but contains semantic errors. Validate your business logic.
  </Accordion>
</AccordionGroup>

### System Errors (100003, 100006-100013)

<AccordionGroup>
  <Accordion title="UnknownErr - 100003">
    An unknown error occurred. Contact support with your request details.
  </Accordion>

  <Accordion title="DbErr - 100006">
    Database error occurred. Retry the request or contact support.
  </Accordion>

  <Accordion title="MarshalErr - 100007">
    Error serializing or deserializing data. Check your request format.
  </Accordion>

  <Accordion title="InternalErr - 100008">
    Internal system error. Contact support if the issue persists.
  </Accordion>

  <Accordion title="HttpErr - 100009">
    HTTP communication error. Check your network connection and retry.
  </Accordion>

  <Accordion title="SetupErr - 100010">
    System setup or configuration error. Contact support.
  </Accordion>

  <Accordion title="NotImplementedErr - 100011">
    Feature not yet implemented. Check the API documentation for available features.
  </Accordion>

  <Accordion title="ExtApiErr - 100012">
    External API error. A third-party service encountered an issue.
  </Accordion>

  <Accordion title="TimeoutErr - 100013">
    Operation timed out. Retry the request.
  </Accordion>
</AccordionGroup>

## Quick Reference Table

| Code   | Error Name             | Category    | Description                    |
| ------ | ---------------------- | ----------- | ------------------------------ |
| 0      | Success                | Success     | Request completed successfully |
| 100000 | NotFoundErr            | Client      | Resource not found             |
| 100001 | NotAuthenticatedErr    | Client      | Authentication failed          |
| 100002 | NotAuthorizedErr       | Client      | Authorization failed           |
| 100003 | UnknownErr             | System      | Unknown error                  |
| 100004 | InvalidArgsErr         | Client      | Invalid arguments              |
| 100005 | ConflictErr            | Client      | Resource conflict              |
| 100006 | DbErr                  | System      | Database error                 |
| 100007 | MarshalErr             | System      | Serialization error            |
| 100008 | InternalErr            | System      | Internal error                 |
| 100009 | HttpErr                | System      | HTTP error                     |
| 100010 | SetupErr               | System      | Setup error                    |
| 100011 | NotImplementedErr      | System      | Not implemented                |
| 100012 | ExtApiErr              | System      | External API error             |
| 100013 | TimeoutErr             | System      | Timeout error                  |
| 100014 | ExpiredErr             | Client      | Resource expired               |
| 100015 | InvalidErr             | Client      | Invalid data                   |
| 100016 | MfaRequiredErr         | Client      | MFA required                   |
| 100017 | RequestErr             | Client      | Request error                  |
| 100018 | BlockedErr             | Client      | Account blocked                |
| 100019 | BlacklistedErr         | Client      | Resource blacklisted           |
| 100020 | RetryExceededErr       | Operational | Retry limit exceeded           |
| 100021 | NotSupportedErr        | Operational | Not supported                  |
| 100022 | MfaSetupRequiredErr    | Operational | MFA setup required             |
| 100023 | InvalidQuoteErr        | Operational | Invalid quote                  |
| 100024 | ServerErr              | Server      | Server error                   |
| 100025 | RequestTimeoutErr      | Server      | Request timeout                |
| 100026 | PayloadSizeErr         | Server      | Payload too large              |
| 100027 | RateLimitErr           | Server      | Rate limit exceeded            |
| 100028 | BadGatewayErr          | Server      | Bad gateway                    |
| 100029 | ServiceUnavailableErr  | Server      | Service unavailable            |
| 100030 | GatewayTimeoutErr      | Server      | Gateway timeout                |
| 100031 | InvalidMethodErr       | Server      | Invalid HTTP method            |
| 100032 | UnprocessableEntityErr | Server      | Unprocessable entity           |

<Warning>
  Always implement proper error handling in your application. Log error codes and messages for debugging purposes.
</Warning>
