{
  "openapi": "3.0.0",
  "info": {
    "title": "x-gateway-external-api",
    "contact": {}
  },
  "servers": [
    {
      "url": "https://api.xgateway.tech/api/v2"
    }
  ],
  "paths": {
    "/exchange/rate": {
      "get": {
        "operationId": "ConvertOneAsync",
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppSuccessResponse_string_"
                },
                "examples": {
                  "Example 1": {
                    "value": {
                      "data": "0.00001668",
                      "success": true
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorResponse"
                },
                "examples": {
                  "Example 1": {
                    "value": {
                      "errors": [
                        {
                          "code": "not_found",
                          "message": "The exchange rate could not be found."
                        }
                      ],
                      "success": false
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppValidationErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorResponse"
                }
              }
            }
          }
        },
        "description": "Returns a converted amount to the specified currency formatted as a string.",
        "summary": "Returns a converted amount.",
        "tags": [
          "Exchange"
        ],
        "security": [],
        "parameters": [
          {
            "description": "- The amount to convert (optional). Can be a number or string\r\nrepresentation. Defaults to `1`.",
            "in": "query",
            "name": "amount",
            "required": false,
            "schema": {
              "default": "1"
            }
          },
          {
            "description": "- The currency to convert to/from (see the `direction` parameter).",
            "in": "query",
            "name": "target",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Currency"
            }
          },
          {
            "description": "- The currency to convert from/to (see the `direction` parameter).",
            "in": "query",
            "name": "source",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Currency"
            }
          },
          {
            "description": "- The direction to convert value. Defaults to\r\n`toTarget`.",
            "in": "query",
            "name": "direction",
            "required": false,
            "schema": {
              "default": "toTarget",
              "type": "string",
              "enum": [
                "toSource",
                "toTarget"
              ]
            }
          },
          {
            "description": "- The invoice id for fixed invoices rates.",
            "in": "query",
            "name": "invoiceId",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "AppSuccessResponse_string_": {
        "description": "The AppSuccessResponse object contains general information about the success execution.",
        "properties": {
          "success": {
            "type": "boolean",
            "default": true
          },
          "data": {
            "type": "string"
          }
        },
        "required": [
          "success",
          "data"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "AppClientErrorResponseCode": {
        "type": "string",
        "enum": [
          "bad_request",
          "db_violation",
          "unauthorized",
          "payment_required",
          "forbidden",
          "not_found",
          "method_not_allowed",
          "not_acceptable",
          "proxy_authentication_required",
          "request_timeout",
          "conflict",
          "db_unique_violation",
          "gone",
          "length_required",
          "precondition_failed",
          "payload_too_large",
          "uri_too_long",
          "unsupported_media_type",
          "range_not_satisfiable",
          "expectation_failed",
          "misdirected_request",
          "unprocessable_content",
          "db_non_null_violation",
          "locked",
          "failed_dependency",
          "upgrade_required",
          "precondition_required",
          "too_many_requests",
          "request_header_fields_too_large",
          "unavailable_for_legal_reasons"
        ],
        "nullable": false,
        "description": "The AppClientErrorResponseCode object contains all client error response codes."
      },
      "AppServerErrorResponseCode": {
        "type": "string",
        "enum": [
          "internal_server_error",
          "not_implemented",
          "bad_gateway",
          "service_unavailable",
          "gateway_timeout",
          "http_version_not_supported",
          "variant_also_negotiates",
          "insufficient_storage",
          "loop_detected",
          "not_extended",
          "network_authentication_required"
        ],
        "nullable": false,
        "description": "The AppServerErrorResponseCode object contains all server error response codes."
      },
      "IAppError": {
        "description": "The IAppError interface represents an application error message.",
        "properties": {
          "code": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AppClientErrorResponseCode"
              },
              {
                "$ref": "#/components/schemas/AppServerErrorResponseCode"
              }
            ]
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "code",
          "message"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "AppErrorResponse": {
        "description": "The AppErrorResponse object contains general information about the error message.",
        "properties": {
          "success": {
            "type": "boolean",
            "default": false
          },
          "errors": {
            "items": {
              "$ref": "#/components/schemas/IAppError"
            },
            "type": "array"
          }
        },
        "required": [
          "success",
          "errors"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "AppValidationErrorResponse": {
        "description": "The AppValidationErrorResponse object contains general information about the validation error.",
        "properties": {
          "success": {
            "type": "boolean",
            "default": false
          },
          "errors": {
            "items": {},
            "type": "array"
          }
        },
        "required": [
          "success",
          "errors"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "Currency": {
        "type": "string",
        "enum": [
          "USDC",
          "USDT",
          "BNB",
          "bUSDT",
          "BTC",
          "ETH",
          "eUSDC",
          "eUSDT",
          "FTN",
          "POL",
          "pUSDC",
          "SOL",
          "sUSDT",
          "TRX",
          "tUSDC",
          "tUSDT",
          "wpUSDC",
          "wpUSDT",
          "EUR",
          "GBP",
          "AZN",
          "BDT",
          "INR",
          "JPY",
          "PKR",
          "RUB",
          "TRY",
          "UZS",
          "AUD",
          "BRL",
          "CAD",
          "CHF",
          "CZK",
          "DKK",
          "KES",
          "NOK",
          "NZD",
          "SEK",
          "USD"
        ],
        "description": "Represents all currencies in the payment processing system.\r\n\r\nUsed to specify the currency of accounts, exchange rates, and transactions in the payment\r\nprocessing system.\r\n\r\nIt provides a controlled and standardized list of supported currencies for all transactions and\r\nbalances in the payment processing system.\r\n\r\nNew currencies can be added to the payment processing system as additional members.\r\n\r\nSupported cryptocurrencies:\r\n- `BNB` - Binance Coin\r\n- `bUSDT` - Tether (pegged to USD), issued on BNB Smart Chain network (BEP20 token)\r\n- `BTC` - Bitcoin\r\n- `ETH` - Ether\r\n- `eUSDC` - USD Coin (pegged to USD), issued on Ethereum network (ERC20 token)\r\n- `eUSDT` - Tether (pegged to USD), issued on Ethereum network (ERC20 token)\r\n- `FTN` - Fasttoken\r\n- `POL` - POL\r\n- `pUSDC` - USD Coin (pegged to USD), issued on Polygon network (ERC20 token)\r\n- `SOL` - SOL\r\n- `sUSDT` - Tether (pegged to USD), issued on Solana network (SPL token)\r\n- `TRX` - Tronix (native coin), issued on Tron network\r\n- `tUSDC` - USD Coin (pegged to USD), issued on Tron network (TRC20 token)\r\n- `tUSDT` - Tether (pegged to USD), issued on Tron network (TRC20 token)\r\n- `wpUSDC` - wrapped USD Coin (pegged to USD), issued on Polygon network (ERC20 token)\r\n- `wpUSDT` - wrapped Tether (pegged to USD), issued on Polygon network (ERC20 token).\r\n\r\nSupported fiat currencies:\r\n- `AZN` - Azerbaijani Manat\r\n- `BDT` - Bangladeshi Taka\r\n- `EUR` - Euro\r\n- `GBP` - Pound Sterling\r\n- `INR` - Indian Rupee\r\n- `JPY` - Japanese Yen\r\n- `KES` - Kenyan Shilling\r\n- `PKR` - Pakistani Rupee\r\n- `RUB` - Russian Ruble\r\n- `TRY` - Turkish Lira\r\n- `USD` - United States Dollar\r\n- `UZS` - Uzbekistani Som."
      }
    }
  }
}