### Get Exchange Amount Response Examples Source: https://api-docs.changehero.io/index Demonstrates the successful response formats for both single and bulk requests when fetching exchange amounts. It outlines the structure of the JSON response, including the 'jsonrpc' version, 'id', and 'result' fields. ```json HTTP/1.1 200 OK { "jsonrpc": "2.0", "id": "test", "result": "0.016983498" } ``` ```json HTTP/1.1 200 OK { "jsonrpc": "2.0", "id": "test", "result": [ { "from": "eth", "to": "btc", "amount": 1, "result": "0.017141538089731637", "networkFee": "0.0001500000000000000000" }, ... ] } ``` -------------------------------- ### Get Minimal Amount Response Examples Source: https://api-docs.changehero.io/index Illustrates the successful response formats for both single and bulk requests when querying the minimum amount required for an exchange. It shows the structure of the JSON response, including the 'jsonrpc' version, 'id', and 'result' fields. ```json HTTP/1.1 200 OK { "jsonrpc": "2.0", "id": "test", "result": "0.1433161839470963" } ``` ```json HTTP/1.1 200 OK { "jsonrpc": "2.0", "id": "test", "result": [ { "from": "eth", "to": "btc", "minAmount": "0.1433161839470963" }, ... ] } ``` -------------------------------- ### Register Partner by Email (cURL Example) Source: https://api-docs.changehero.io/index This example demonstrates how to register a new partner using their email address via a cURL command. It includes the necessary headers and a JSON payload with email, password, and consent. The password must meet specific security requirements. ```bash curl -X POST \ http://localhost:3000/v3/partners/register/email \ -H 'Content-Type: application/json' \ -H 'Cache-Control: no-cache' \ -d '{ "email": "user@example.com", "password": "Test1234!", "consent": true }' ``` -------------------------------- ### JSON-RPC 2.0 Example Request Source: https://api-docs.changehero.io/index An example of a JSON-RPC 2.0 request to the ChangeHero API, demonstrating the structure for methods like getMinAmount. It includes the version, a unique ID, the method name, and parameters. ```json { "jsonrpc": "2.0", "id": "test", "method": "getMinAmount", "params": { "from": "btc", "to": "eth" } } ``` -------------------------------- ### JSON-RPC 2.0 Example Response Source: https://api-docs.changehero.io/index An example of a JSON-RPC 2.0 response from the ChangeHero API, showing a successful result for a method. It includes the version, the request ID, and the result data. ```json { "jsonrpc": "2.0", "id": "test", "result": "0.01" } ``` -------------------------------- ### Get Supported Currencies API Source: https://api-docs.changehero.io/index Returns a list of all available currencies with their descriptions and current states. ```APIDOC ## POST /api/v1/currencies ### Description Returns a list of all available currencies with their descriptions and current states. ### Method POST ### Endpoint /api/v1/currencies ### Parameters #### Request Body - **method** (String) - Required - Should be `getCurrenciesFull`. - **params** (Object) - Required - Empty params object. ### Request Example ```json { "jsonrpc": "2.0", "id": "test", "method": "getCurrenciesFull", "params": {} } ``` ### Response #### Success Response (200) - **jsonrpc** (String) - JSON RPC version. - **id** (String) - Request ID. - **result** (Array) - An array of currency objects, each containing details about a supported currency. #### Response Example ```json { "jsonrpc": "2.0", "id": "test", "result": [ { "ticker": "btc", "name": "Bitcoin", "image": "https://...", "enabled": true, "_id": "60a7b1f4c3f3a3001f8e4c7a" }, { "ticker": "eth", "name": "Ethereum", "image": "https://...", "enabled": true, "_id": "60a7b1f4c3f3a3001f8e4c7b" } ] } ``` ``` -------------------------------- ### Get Fixed Rate API Description and Response Source: https://api-docs.changehero.io/index Details the 'getFixRate' API method, which provides a fixed exchange rate. It specifies the parameters required, response fields such as rate ID, rate, minimum/maximum amounts, and expiration time, along with an example of a successful response. ```json HTTP/1.1 200 OK { "jsonrpc": "2.0", "id": "test", "result": [ { "id": "6671323a-2817-4243-9abe-50bcab1a328c", "result": "0.01703065345050488975", "from": "eth", "to": "btc", "min": "0.1295174746768899800000", "max": "46.4999761826753900000000", "minFrom": "0.1295174746768899800000", "maxFrom": "46.4999761826753900000000", "minTo": "0.0022260000000000000000", "maxTo": "0.8000000000000000000000" "expiresIn": 600, "networkFee": "0.0015" }, ... ] } ``` -------------------------------- ### Get Supported Pairs Source: https://api-docs.changehero.io/index Retrieves a list of currently enabled currency pairs. Pairs disabled for partners are not included. ```APIDOC ## POST /api ### Description Returns a list of currently enabled pairs. Pairs disabled for partner are not returned in that list. ### Method POST ### Endpoint /api ### Parameters #### Request Body - **method** (String) - Required - Should be `getPairs`. - **params** (Object) - Required - Empty params object. ### Request Example ```json { "jsonrpc": "2.0", "id": "test", "method": "getPairs", "params": {} } ``` ### Response #### Success Response (200) - **from** (String) - The source currency ticker. - **to** (String) - The destination currency ticker. #### Response Example ```json { "jsonrpc": "2.0", "id": "test", "result": [ { "from": "BTC", "to": "ETH" }, { "from": "BTC", "to": "TRX" } ] } ``` ``` -------------------------------- ### Get Affiliate Information Source: https://api-docs.changehero.io/index Retrieves information about the affiliate profile and their accrued rewards. ```APIDOC ## POST /api/v1/affiliate ### Description Returns information about the affiliate profile and rewards. ### Method POST ### Endpoint /api/v1/affiliate ### Parameters #### Request Body - **method** (string) - Required - Should be `getAffiliateInfo`. - **params** (object) - Required - Empty params object. ### Request Example ```json { "jsonrpc": "2.0", "id": "test", "method": "getAffiliateInfo", "params": {} } ``` ### Response #### Success Response (200) - **referrerId** (string) - Referral ID that is used in referral link. - **refLink** (string) - Referral link. - **payoutAddress** (string) - Withdrawal address. - **liabilities** (array) - Accrued reward balance information. - **ticker** (string) - Currency ticker. - **currentAmount** (number) - Current balance of accrued rewards. - **totalAmount** (number) - Total accrued rewards. #### Response Example ```json { "jsonrpc": "2.0", "id": "test", "result": { "referrerId": "992a603eb3424962baa6a28bef243a11", "refLink": "https://changehero.io/?ref=992a603eb3424962baa6a28bef243a11", "payoutAddress": "bc1qwqdg6squsna38e46795at95yu9atm9azzmyvckulcc7kytlcckxswvvzej", "liabilities": [ { "ticker": "btc", "currentAmount": 1.0, "totalAmount": 3.6500059585 } ] } } ``` ``` -------------------------------- ### Get Bulk Fixed Rate (HTTP) Source: https://api-docs.changehero.io/index This HTTP response details the structure for getting bulk fixed rates for currency pairs. It provides rate information including an ID, the exchange rate, currency tickers, amount limits, rate lifetime, and network fee. ```HTTP HTTP/1.1 200 OK { "jsonrpc": "2.0", "id": "test", "result": [ { "id": "f5b0da00-1f12-42e8-9f50-5afb91e89ed6", "result": "9.5333196619093798538", "from": "eth", "to": "bnb", "minFrom": "0.1290000000000000000000", "maxFrom": "46.5710000000000000000000" "expiresIn": 600, "networkFee": "0.00025" }, ... ] } ``` -------------------------------- ### Get Supported Currencies Source: https://api-docs.changehero.io/index Retrieves a list of currently enabled currencies. Temporarily disabled currencies are not included in the response. ```APIDOC ## POST /api ### Description Returns a list of currently enabled currencies. Temporarily disabled currencies are not returned in this list. ### Method POST ### Endpoint /api ### Parameters #### Request Body - **method** (String) - Required - Should be `getCurrencies`. - **params** (Object) - Required - Empty params object. ### Request Example ```json { "jsonrpc": "2.0", "id": "test", "method": "getCurrencies", "params": {} } ``` ### Response #### Success Response (200) - **name** (String) - Currency ticker. - **fullName** (String) - Currency full name. - **enabled** (Boolean) - Checked if the currency is available for exchange. - **fixRateEnabled** (Boolean) - Checked if the currency is enabled for fixed rate exchange. - **extraIdName** (String) - Type of the coin's extra/tag (i.e. memo, destination tag, payment ID). - **addressUrl** (String) - URL-address of the page with address/transaction on a blockchain explorer. Returns `null` if not customized. - **transactionUrl** (String) - URL-address of the page with address/transaction on a blockchain explorer. Returns `null` if not customized. - **image** (String) - URL of currency logo in SVG format. - **fixedTime** (Number) - Default fixed time. - **enabledFrom** (Boolean) - Checked if the currency is available for deposit. - **enabledTo** (Boolean) - Checked if the currency is available for withdrawal. - **payinConfirmations** (Number) - Currency confirmations for accepting on ChangeHero side. - **protocol** (String) - Only set for some tokens. - **blockchain** (String) - Blockchain of the coin. - **contractAddress** (String) - Only set for some tokens. - **precision** (Number) - Number of decimal places for the currency. #### Response Example ```json { "jsonrpc": "2.0", "id": "test", "result": [ { "name": "ardr", "fullName": "Ardor", "enabled": true, "fixRateEnabled": true, "extraIdName": "Message", "addressUrl": null, "transactionUrl": null, "image": "https://changehero.io/static/images/coins/ardr.svg", "fixedTime": 600000, "inboundEnabled": true, "outboundEnabled": true } ] } ``` ``` -------------------------------- ### Get Supported Pairs Response Source: https://api-docs.changehero.io/index This snippet illustrates the response format for retrieving a list of supported currency pairs. It indicates which currency can be exchanged for another, with 'from' and 'to' fields. ```json HTTP/1.1 200 OK { "jsonrpc": "2.0", "id": "test", "result": [ { "from": "BTC", "to": "ETH" }, { "from": "BTC", "to": "TRX" }, ... ] } ``` -------------------------------- ### Get Bulk Fixed Rate Source: https://api-docs.changehero.io/index Retrieves the amount frame for fixed rates across all available currency pairs. ```APIDOC ## POST /api/v1/rate ### Description Returns amount frame within which a fixed rate is provided for all available pairs. ### Method POST ### Endpoint /api/v1/rate ### Parameters #### Request Body - **method** (string) - Required - Should be `getFixRateBulk`. - **params** (object) - Required - Empty params object. ### Request Example ```json { "jsonrpc": "2.0", "id": "test", "method": "getFixRateBulk", "params": {} } ``` ### Response #### Success Response (200) - **id** (string) - `rateId`. - **result** (string) - Fixed exchange rate. - **from** (string) - Input currency ticker. - **to** (string) - Output currency ticker. - **minFrom** (string) - Minimum amount of input currency. - **maxFrom** (string) - Maximum amount of input currency. - **expiresIn** (integer) - Rate lifetime in seconds. - **networkFee** (string) - Network (miner) fee, will be deducted from the final amount. #### Response Example ```json { "jsonrpc": "2.0", "id": "test", "result": [ { "id": "f5b0da00-1f12-42e8-9f50-5afb91e89ed6", "result": "9.5333196619093798538", "from": "eth", "to": "bnb", "minFrom": "0.1290000000000000000000", "maxFrom": "46.5710000000000000000000", "expiresIn": 600, "networkFee": "0.00025" }, ... ] } ``` ``` -------------------------------- ### Get Affiliate Information (HTTP) Source: https://api-docs.changehero.io/index This HTTP response shows the structure for retrieving affiliate information. It includes the referrer ID, referral link, payout address, and a list of liabilities (accrued rewards). ```HTTP HTTP/1.1 200 OK { "jsonrpc": "2.0", "id": "test", "result": { "referrerId": "992a603eb3424962baa6a28bef243a11", "refLink": "https://changehero.io/?ref=992a603eb3424962baa6a28bef243a11", "payoutAddress": "bc1qwqdg6squsna38e46795at95yu9atm9azzmyvckulcc7kytlcckxswvvzej", "liabilities": [ { "ticker": "btc", "currentAmount": 1.0, "totalAmount": 3.6500059585 } ] } } ``` -------------------------------- ### Create Transaction Request (JSON-RPC 2.0) Source: https://api-docs.changehero.io/index Example JSON-RPC 2.0 request to create a standard transaction. This method requires parameters like from, to, address, amount, and optionally refund details. ```json { "jsonrpc": "2.0", "id": "test", "method": "createTransaction", "params": { "from": "btc", "to": "eth", "address": "RECIPIENT_ADDRESS", "amount": "0.1" } } ``` -------------------------------- ### GET /v3/partners/reset-password Source: https://api-docs.changehero.io/index Resets a partner's password using a provided email and token. ```APIDOC ## GET /v3/partners/reset-password ### Description Resets a partner's password using a provided email and token. ### Method GET ### Endpoint /v3/partners/reset-password ### Parameters #### Path Parameters None #### Query Parameters - **email** (string) - Required - User email - **token** (string) - Required - Token that was sent to the user in the email ### Request Example ``` GET /v3/partners/reset-password?email=user@example.com&token=your_reset_token ``` ### Response #### Success Response (200) - **true** (boolean) - Indicates successful password reset. #### Response Example ```json { "true": true } ``` #### Error Responses - **400 Bad Request**: Required parameters (email or token) were not found. - **401 Unauthorized**: Invalid token. - **403 Forbidden**: Reset link has expired. - **500 Internal Server Error**: Internal server error. ``` -------------------------------- ### Get Transactions List Source: https://api-docs.changehero.io/index Retrieves a list of all transactions based on specified filter parameters. Supports pagination and filtering by currency, payout address, and transaction ID. ```APIDOC ## POST /api/transactions ### Description Returns a list of all transactions that satisfy request parameters. ### Method POST ### Endpoint /api/transactions ### Parameters #### Query Parameters - **method** (String) - Required - Should be `getTransactions`. - **params** (Object) - Required - Nested params object. - **id** (String) - Optional - Transaction id filter. - **currency** (String) - Optional - Currency from filter. - **payoutAddress** (String) - Optional - Payout address filter. - **offset** (Number) - Optional - =0 Offset value for server pagination. - **limit** (Number) - Optional - =100 Limit value for server pagination. ### Response #### Success Response (200) - **id** (String) - Transaction ID. Can also be used in `getStatus` method. - **status** (String) - The status of transaction. - **currencyFrom** (String) - Input currency ticker. - **currencyTo** (String) - Output currency ticker. - **payinHash** (String) - Transaction hash for incoming transaction. - **payoutHash** (String) - Transaction hash for outgoing transaction. - **refundHash** (String) - Transaction hash in case the transaction was refunded. - **payinAddress** (String) - Address to which the user sends their assets for exchanging. - **payinExtraId** (String) - `extraId` (memo, destination tag, payment ID etc.) for `payinAddress`, if needed. - **payoutAddress** (String) - Address to which the exchanged assets will be sent. - **payoutExtraId** (String) - `extraId` (memo, destination tag, payment ID etc.) for `payoutAddress`, if needed. - **amountExpectedFrom** (String) - Amount intended for exchanging at the moment of `createTransaction` or `createFixTransaction`. - **amountExpectedTo** (String) - Amount equal to the result of exchange at the moment of `createTransaction` at a float rate or exchange within the set time frame at a fixed rate. - **amountFrom** (String) - Real amount of funds received at `payinAddress`. - **amountTo** (String) - Real amount of funds sent to `payoutAddress` after the exchange. - **refundReason** (String) - Reason of the refund. - **networkFee** (String) - Network fee in case it's a `float` transaction or `subtractNetworkFee` feature is on. - **createdAt** (Number) - Exact time when the transaction was created, in seconds since 01/01/1970 (Unix Epoch). - **duration** (Number) - Time elapsed from first detecting a valid incoming blockchain transaction to obtaining the ChangeHero transaction `finished` status, in seconds. - **transactionType** (String) - Transaction type may `fix` or `float`. - **payinSenders** (Array) - The array of customer blockchain sending accounts. ### Request Example ```json { "jsonrpc": "2.0", "id": "test", "method": "getTransactions", "params": { "currency": "btc", "limit": 100 } } ``` ### Response Example ```json { "jsonrpc": "2.0", "id": "test", "result": [ { "id": "3j1b4ad1o9j47ivy6a", "status": "finished", "currencyFrom": "edg", "currencyTo": "eth", "payinHash": "0xc280caf791ea6d27fa138c3cc987dc5721e24f91ebfd2effdd71378bcaf57974", "payoutHash": "0x00e9ff9308be15b04c2503faebac556d4c3f108e16d3076adda2579d47450409", "refundHash": null, "payinAddress": "0x174d9c4aa22991dcc40afb7dd73a377a978c6d28", "payinExtraId": null, "payoutAddress": "0x074d9c4aa22890dcc40afb7dd73b377a978c5d29", "payoutExtraId": null, "amountExpectedFrom": "1000", "amountExpectedTo": "0.02", "amountFrom": "1094.0000000000000000000000", "amountTo": "0.0215934600000000000000", "refundReason": null, "networkFee": "0.0005500000000000000000", "createdAt": 1556480419, "duration": 90, "transactionType": "fix", "payinSenders": ["0x690b9a9e9aa1c9db991c7721a92d351db4fac990"] } ] } ``` ``` -------------------------------- ### Get Current Network Fees Source: https://api-docs.changehero.io/index Retrieves the current network fees for cryptocurrency transactions. This data is subject to frequent changes. ```APIDOC ## POST /api/v1/fees ### Description Returns current network fees. The subject for frequent changes by reason of blockchain nature. ### Method POST ### Endpoint /api/v1/fees ### Parameters #### Request Body - **method** (string) - Required - Should be `getNetworkFees`. - **params** (object) - Required - Nested params object. - **currency** (string) - Optional - Currency ticker for which to get the network fee. ### Request Example (Specific Currency) ```json { "jsonrpc": "2.0", "id": "test", "method": "getNetworkFees", "params": { "currency": "btc" } } ``` ### Request Example (All Currencies) ```json { "jsonrpc": "2.0", "id": "test", "method": "getNetworkFees", "params": {} } ``` ### Response #### Success Response (200) - Specific Currency - **result** (string) - The network fee for the specified currency. #### Response Example (Specific Currency) ```json { "jsonrpc": "2.0", "id": "test", "result": "0.0005" } ``` #### Success Response (200) - All Currencies - **result** (object) - An object containing network fees for various currencies. - **currency_ticker** (string) - The network fee for that currency. #### Response Example (All Currencies) ```json { "jsonrpc": "2.0", "id": "test", "result": { "btc": "0.0005", ... } } ``` ``` -------------------------------- ### Create Fixed Rate Transaction Request (JSON-RPC 2.0) Source: https://api-docs.changehero.io/index Example JSON-RPC 2.0 request to create a fixed-rate transaction. This method requires parameters like rateId, from, to, address, and optionally amount or amountTo, along with refund details. ```json { "jsonrpc": "2.0", "id": "test", "method": "createFixTransaction", "params": { "rateId": "YOUR_RATE_ID", "from": "eth", "to": "btc", "address": "RECIPIENT_ADDRESS", "amount": "1" } } ``` -------------------------------- ### Get Current Network Fees (HTTP - All Currencies) Source: https://api-docs.changehero.io/index This HTTP response illustrates fetching current network fees for all available currencies. It returns an object where keys are currency tickers and values are their respective network fees. ```HTTP HTTP/1.1 200 OK { "jsonrpc": "2.0", "id": "test", "result": { "btc": "0.0005", ... } } ``` -------------------------------- ### Get Supported Currencies Response Source: https://api-docs.changehero.io/index This snippet shows the structure of a successful response when requesting a list of supported currencies. It includes details like currency name, full name, availability for exchange, and image URLs. ```json HTTP/1.1 200 OK { "jsonrpc": "2.0", "id": "test", "result": [ { "name": "ardr", "fullName": "Ardor", "enabled": true, "fixRateEnabled": true, "extraIdName": "Message", "addressUrl": null, "transactionUrl": null, "image": "https://changehero.io/static/images/coins/ardr.svg", "fixedTime": 600000, "inboundEnabled": true, "outboundEnabled": true }, ... ] } ``` -------------------------------- ### Get Fixed Rate API Source: https://api-docs.changehero.io/index Returns the amount frame within which a fixed rate is provided. The method is designed to be bulk, but still you can specify here params as array or single object. ```APIDOC ## POST /api/v1/rate ### Description Returns the amount frame within which a fixed rate is provided. The method is designed to be bulk, but still you can specify here params as array or single object. ### Method POST ### Endpoint /api/v1/rate ### Parameters #### Request Body - **method** (String) - Required - Should be `getFixRate`. - **params** (Object) - Required - Nested params object. - **from** (String) - Required - Currency from. - **to** (String) - Required - Currency to. ### Request Example ```json { "jsonrpc": "2.0", "id": "test", "method": "getFixRate", "params": { "from": "eth", "to": "btc" } } ``` ### Response #### Success Response (200) - **jsonrpc** (String) - JSON RPC version. - **id** (String) - Request ID. - **result** (Array) - An array of fixed rate objects. - **id** (String) - `rateId`. - **result** (String) - Fixed exchange rate. - **from** (String) - Input currency ticker. - **to** (String) - Output currency ticker. - **min** (String) - Minimum amount of input currency. - **max** (String) - Maximum amount of input currency. - **minFrom** (String) - Minimum amount of input currency. - **maxFrom** (String) - Maximum amount of input currency. - **minTo** (String) - Minimum amount of output currency. - **maxTo** (String) - Maximum amount of output currency. - **expiresIn** (Number) - Rate lifetime in seconds. - **networkFee** (String) - Network (miner) fee, will be deducted from the final amount. #### Response Example ```json { "jsonrpc": "2.0", "id": "test", "result": [ { "id": "6671323a-2817-4243-9abe-50bcab1a328c", "result": "0.01703065345050488975", "from": "eth", "to": "btc", "min": "0.1295174746768899800000", "max": "46.4999761826753900000000", "minFrom": "0.1295174746768899800000", "maxFrom": "46.4999761826753900000000", "minTo": "0.0022260000000000000000", "maxTo": "0.8000000000000000000000", "expiresIn": 600, "networkFee": "0.0015" } ] } ``` ``` -------------------------------- ### Get Exchange Amount Source: https://api-docs.changehero.io/index Estimates the amount of assets a customer will receive for an exchange. Supports single or multiple currency pairs. ```APIDOC ## POST /api/v1/exchange/amount ### Description Returns an estimated amount of assets customer receives as a result of exchange. When requesting more than one currency pair with `getExchangeAmount` please pass array of arguments. ### Method POST ### Endpoint /api/v1/exchange/amount ### Parameters #### Request Body - **method** (string) - Required - Should be `getExchangeAmount`. - **params** (object|array) - Required - Either a single object for one pair or an array of objects for multiple pairs. - **from** (string) - Required - Input currency ticker. - **to** (string) - Required - Output currency ticker. - **amount** (string) - Required - The amount of the input currency. - **rateId** (string) - Optional - The ID of a previously obtained fixed rate. ### Request Example (Single Pair) ```json { "jsonrpc": "2.0", "id": "test", "method": "getExchangeAmount", "params": { "from": "eth", "to": "btc", "amount": "1" } } ``` ### Request Example (Multiple Pairs) ```json { "jsonrpc": "2.0", "id": "test", "method": "getExchangeAmount", "params": [ { "from": "eth", "to": "btc", "amount": "1" }, { "from": "btc", "to": "eth", "amount": "0.1" } ] } ``` ### Response #### Success Response (200) - **result** (string|array) - If a single pair was requested, returns the estimated amount as a string. If multiple pairs were requested, returns an array of estimated amounts. #### Response Example (Single Pair) ```json { "jsonrpc": "2.0", "id": "test", "result": "0.016920296343091775" } ``` #### Response Example (Multiple Pairs) ```json { "jsonrpc": "2.0", "id": "test", "result": [ "0.016920296343091775", "5.91616579316878" ] } ``` ``` -------------------------------- ### Get Current Network Fees (HTTP - Single Currency) Source: https://api-docs.changehero.io/index This HTTP response shows the result of fetching current network fees for a specific currency. It returns a single string value representing the fee. ```HTTP HTTP/1.1 200 OK { "jsonrpc": "2.0", "id": "test", "result": "0.0005" } ``` -------------------------------- ### Get Exchange Amount API Source: https://api-docs.changehero.io/index Retrieves the exchange amount for a given currency pair and amount. Supports both single and bulk requests. ```APIDOC ## POST /api/v1/exchange ### Description Retrieves the exchange amount for a given currency pair and amount. Supports both single and bulk requests. ### Method POST ### Endpoint /api/v1/exchange ### Parameters #### Request Body - **method** (String) - Required - Should be `getExchangeAmount`. - **params** (Object) - Required - Nested params object. - **from** (String) - Required - Currency from. - **to** (String) - Required - Currency to. - **amount** (String|Number) - Required - Amount from. ### Request Example ```json { "jsonrpc": "2.0", "id": "test", "method": "getExchangeAmount", "params": { "from": "eth", "to": "btc", "amount": 1 } } ``` ### Response #### Success Response (200) - **jsonrpc** (String) - JSON RPC version. - **id** (String) - Request ID. - **result** (String|Array) - The exchange amount or an array of exchange results for bulk requests. #### Response Example (Single) ```json { "jsonrpc": "2.0", "id": "test", "result": "0.016983498" } ``` #### Response Example (Bulk) ```json { "jsonrpc": "2.0", "id": "test", "result": [ { "from": "eth", "to": "btc", "amount": 1, "result": "0.017141538089731637", "networkFee": "0.0001500000000000000000" } ] } ``` ``` -------------------------------- ### API Endpoint: Get Transactions List Source: https://api-docs.changehero.io/index Retrieves a list of all transactions based on specified request parameters. This endpoint requires a 'getTransactions' method and accepts optional parameters for filtering and pagination. ```http HTTP/1.1 200 OK { "jsonrpc": "2.0", "id": "test", "result": [ { "id": "3j1b4ad1o9j47ivy6a", "status": "finished", "currencyFrom": "edg", "currencyTo": "eth", "payinHash": "0xc280caf791ea6d27fa138c3cc987dc5721e24f91ebfd2effdd71378bcaf57974", "payoutHash": "0x00e9ff9308be15b04c2503faebac556d4c3f108e16d3076adda2579d47450409", "refundHash": null, "payinAddress": "0x174d9c4aa22991dcc40afb7dd73a377a978c6d28", "payinExtraId": null, "payoutAddress": "0x074d9c4aa22890dcc40afb7dd73b377a978c5d29", "payoutExtraId": null, "amountExpectedFrom": "1000", "amountExpectedTo": "0.02", "amountFrom": "1094.0000000000000000000000", "amountTo": "0.0215934600000000000000", "refundReason": null, "networkFee": "0.0005500000000000000000", "createdAt": 1556480419, "duration": 90, "transactionType": "fix", "payinSenders": ["0x690b9a9e9aa1c9db991c7721a92d351db4fac990"], }, ... ] } ``` -------------------------------- ### Get Minimum Exchange Amount API Source: https://api-docs.changehero.io/index Returns a currency pair minimum amount a customer should send to proceed with the transaction. When requesting more than one currency pair, pass an array of arguments. ```APIDOC ## POST /api/v1/min-amount ### Description Returns a currency pair minimum amount a customer should send to proceed with the transaction. When requesting more than one currency pair, pass an array of arguments. ### Method POST ### Endpoint /api/v1/min-amount ### Parameters #### Request Body - **method** (String) - Required - Should be `getMinAmount`. - **params** (Object) - Required - Nested params object. - **from** (String) - Required - Currency from. - **to** (String) - Required - Currency to. ### Request Example ```json { "jsonrpc": "2.0", "id": "test", "method": "getMinAmount", "params": { "from": "eth", "to": "btc" } } ``` ### Response #### Success Response (200) - **jsonrpc** (String) - JSON RPC version. - **id** (String) - Request ID. - **result** (String|Array) - The minimum exchange amount or an array of minimum amounts for bulk requests. #### Response Example (Single) ```json { "jsonrpc": "2.0", "id": "test", "result": "0.1433161839470963" } ``` #### Response Example (Bulk) ```json { "jsonrpc": "2.0", "id": "test", "result": [ { "from": "eth", "to": "btc", "minAmount": "0.1433161839470963" } ] } ``` ``` -------------------------------- ### General Information and Protocol Source: https://api-docs.changehero.io/index Provides general information about the ChangeHero API, including default fees and the protocol used (JSON-RPC 2.0). ```APIDOC ## General Information Extra fee by default: **0.5%**, fees calculated in **BTC**. The fee can be changed by email request. ### Protocol ChangeHero API uses JSON-RPC 2.0 protocol. #### Example Request ```json { "jsonrpc": "2.0", "id": "test", "method": "getMinAmount", "params": { "from": "btc", "to": "eth" } } ``` #### Example Response ```json { "jsonrpc": "2.0", "id": "test", "result": "0.01" } ``` `id` used is a custom ID generated at the client side to distinguish responses (as part of JSON RPC 2.0 protocol). You may use any value you want. ### Authentication All requests must contain header `api-key` with the user API key. ``` -------------------------------- ### Get Transaction Status Source: https://api-docs.changehero.io/index Retrieves the status of a specific transaction using its unique ID. ```APIDOC ## POST /api ### Description Returns a status for particular transaction. ### Method POST ### Endpoint /api ### Parameters #### Request Body - **method** (String) - Required - Should be `getStatus`. - **params** (Object) - Required - Nested params object. - **id** (String) - Required - Transaction unique ID. ### Possible transaction statuses: - **waiting**: Transaction is waiting for an incoming payment. - **confirming**: Payment received, waiting for confirmations. - **exchanging**: Payment confirmed, currently exchanging. - **sending**: Coins are being sent to the recipient address. - **finished**: Coins successfully sent to the recipient address. - **failed**: Transaction failed (e.g., amount too low). Contact support with transaction ID. - **refunded**: Exchange failed, coins refunded. User must provide wallet address. - **hold**: Exchange delayed due to AML/KYC procedures. - **expired**: Incoming payment not sent/confirmed within timeframe, or amount mismatch. ### Request Example ```json { "jsonrpc": "2.0", "id": "test", "method": "getStatus", "params": { "id": "your_transaction_id" } } ``` ### Response #### Success Response (200) - **result** (String) - The status of the transaction. #### Response Example ```json { "jsonrpc": "2.0", "id": "test", "result": "confirming" } ``` ``` -------------------------------- ### Partners - Register Partner by Email Source: https://api-docs.changehero.io/index Registers a new partner by email. If consent is provided, marketing preferences will be stored along with the IP address and timestamp of the consent. A verification email will be sent. ```APIDOC ## POST /v3/partners/register/email ### Description Registers a new partner by email. If consent is provided, marketing preferences will be stored along with the IP address and timestamp of the consent. A verification email will be sent to the provided email address. Password must meet security requirements: minimum 8 characters, at least one uppercase letter, one lowercase letter, one number and one special character. ### Method POST ### Endpoint /v3/partners/register/email ### Parameters #### Header - **Content-Type** (string) - application/json #### Request Body - **email** (string) - Required - User email address - **password** (string) - Required - User password - Must be 8-72 characters, include uppercase, lowercase, number, and special character - **consent** (boolean) - Optional - Marketing emails consent flag. Default value: `false` ### Request Example ```bash curl -X POST \ http://localhost:3000/v3/partners/register/email \ -H 'Content-Type: application/json' \ -H 'Cache-Control: no-cache' \ -d '{ "email": "user@example.com", "password": "Test1234!", "consent": true }' ``` ### Response #### Success Response (201) - **success** (boolean) - Always returns true on success #### Response Example ```json { "success": true } ``` #### Error Responses - **400 Bad Request**: Validation error with details. - **409 Conflict**: User already exists. - **500 Internal Server Error**: Internal server error message. ``` -------------------------------- ### Get Transaction Status Response Source: https://api-docs.changehero.io/index This snippet shows the expected response when querying the status of a specific transaction. The result field will contain one of the predefined transaction statuses. ```json HTTP/1.1 200 OK { "jsonrpc": "2.0", "id": "test", "result": "confirming" } ``` -------------------------------- ### Partners - Generic OAuth Handler Source: https://api-docs.changehero.io/index Handles OAuth data from frontend for both Telegram and Google. This endpoint allows users to authenticate using their Telegram or Google accounts. ```APIDOC ## POST /oauth ### Description Handles OAuth data from frontend for both Telegram and Google. Allows users to authenticate using their Telegram or Google accounts. ### Method POST ### Endpoint /oauth ### Parameters #### Request Body - **provider** (string) - Required - Provider type ('telegram' or 'google') - **id** (string) - Required (for Telegram) - Telegram user ID - **first_name** (string) - Required (for Telegram) - User's first name - **username** (string) - Required (for Telegram) - Telegram username - **photo_url** (string) - Optional - Telegram profile photo URL - **email** (string) - Required (for Google) - User's email - **name** (string) - Required (for Google) - User's full name - **picture** (string) - Optional - Google profile picture URL ### Request Example ```json { "provider": "telegram", "id": "12345678", "first_name": "John", "username": "johndoe", "photo_url": "https://t.me/i/userpic/123/photo.jpg" } ``` ```json { "provider": "google", "email": "john@example.com", "name": "John Doe", "picture": "https://lh3.googleusercontent.com/photo.jpg" } ``` ### Response #### Success Response (200) - **success** (boolean) - Always true on successful authentication #### Response Example ```json { "success": true } ``` #### Error Responses - **400 Bad Request**: Validation error details. - **401 Unauthorized**: Token is invalid. - **403 Forbidden**: Token has expired. - **500 Internal Server Error**: An unexpected error occurred. ```