{
  "openapi": "3.0.0",
  "info": {
    "title": "x-gateway-external-api",
    "contact": {}
  },
  "servers": [
    {
      "url": "https://api.xgateway.tech/api/v2"
    }
  ],
  "paths": {
    "/channels": {
      "post": {
        "operationId": "CreateWallet",
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/AppSuccessResponse_IAddressResponse_"
                    },
                    {
                      "$ref": "#/components/schemas/AppErrorResponse"
                    }
                  ]
                },
                "examples": {
                  "Example 1": {
                    "value": {
                      "data": {
                        "address": "n3UrMJG4rxAbXfVWo8dpZ4JLsDZMFm8LM9",
                        "qrCodeURL": "https://objects.xgateway.dev/public/43c33515-8b56-4937-ae48-7bd6de7e11f9.svg"
                      },
                      "success": true
                    }
                  }
                }
              }
            }
          },
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppSuccessResponse_IAddressResponse_"
                }
              }
            }
          },
          "400": {
            "description": "Database violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorResponse"
                },
                "examples": {
                  "Example 1": {
                    "value": {
                      "errors": [
                        {
                          "code": "db_violation",
                          "message": "The request failed because it violated a database constraint."
                        }
                      ],
                      "success": false
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppAuthenticationErrorResponse"
                },
                "examples": {
                  "Example 1": {
                    "value": {
                      "errors": [
                        {
                          "code": "unauthorized",
                          "message": "You do not have permission to access this resource."
                        }
                      ],
                      "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": "Create a channel for the customer for a specified currency.\r\n\r\nAccess to this endpoint requires a valid API key. The API key is sent in the `x-api-key` header on requests.",
        "summary": "Returns a previously created or brand-new address with a link to a QR code.",
        "tags": [
          "Channels"
        ],
        "security": [
          {
            "api_key": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "description": "- Contains currency and customer id.\r\n\r\n__Params__:\r\n- __currency__ - The currency.\r\n- __customerId__ - The customer ID in the external system.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAddressInput",
                "description": "- Contains currency and customer id.\r\n\r\n__Params__:\r\n- __currency__ - The currency.\r\n- __customerId__ - The customer ID in the external system."
              },
              "example": {
                "currency": "BNB",
                "customerId": "ff36a7a5-08fd-418a-a150-f6f2d36676a8"
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "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
      },
      "AppAuthenticationErrorResponse": {
        "description": "The AppAuthenticationErrorResponse object contains general information about the authentication\r\nerror.",
        "properties": {
          "success": {
            "type": "boolean",
            "default": false
          },
          "errors": {
            "items": {
              "$ref": "#/components/schemas/IAppError"
            },
            "type": "array",
            "default": [
              {
                "code": "unauthorized",
                "message": "You do not have permission to access this resource."
              }
            ]
          }
        },
        "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
      },
      "IAddressResponse": {
        "properties": {
          "address": {
            "type": "string"
          },
          "qrCodeURL": {
            "type": "string"
          },
          "qrCode": {
            "type": "string"
          }
        },
        "required": [
          "address"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "AppSuccessResponse_IAddressResponse_": {
        "description": "The AppSuccessResponse object contains general information about the success execution.",
        "properties": {
          "success": {
            "type": "boolean",
            "default": true
          },
          "data": {
            "$ref": "#/components/schemas/IAddressResponse"
          }
        },
        "required": [
          "success",
          "data"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "SupportedCryptoCurrency": {
        "type": "string",
        "enum": [
          "BNB",
          "bUSDT",
          "BTC",
          "ETH",
          "eUSDC",
          "eUSDT",
          "FTN",
          "POL",
          "pUSDC",
          "SOL",
          "sUSDT",
          "TRX",
          "tUSDC",
          "tUSDT",
          "wpUSDC",
          "wpUSDT"
        ],
        "description": "Represents supported crypto currencies in the payment processing system.\r\n\r\nCurrencies:\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)."
      },
      "CreateAddressInput": {
        "properties": {
          "currency": {
            "$ref": "#/components/schemas/SupportedCryptoCurrency"
          },
          "customerId": {
            "type": "string"
          },
          "applicationId": {
            "type": "string"
          }
        },
        "required": [
          "currency",
          "customerId"
        ],
        "type": "object",
        "additionalProperties": false
      }
    },
    "securitySchemes": {
      "api_key": {
        "in": "header",
        "name": "x-api-key",
        "type": "apiKey"
      }
    }
  }
}