Instant exchange API
Basic Info
All request should use the domain:
API URL:
https://api.pegasusswap.com
Protocol: HTTPS only. Authentication: All endpoints require valid API credentials. All request to be executed using HTTPS and following parameters should be used in headers:
Headers | |
---|---|
Accept | application/json |
Content-Type | application/json |
Authorization process
For all requests, an authorization key is required. It grants access to all functions.
These parameters should be included in the headers to configure API authorization:
Request parameters:
Headers | |
---|---|
x-api-public-key | {publicKey} |
x-api-signature | {signature} |
x-api-payload | {payload} |
signature = hex(HMAC_SHA512(payload, key=api_secret))
In the payload field of the request header, you must pass the exact API name of the request you are making. For example, for a request to api/private/get-all-coins, the payload value should be get-all-coins and so on.
Payload meaning:
API Endpoint | Payload |
---|---|
/api/private/get-all-coins | get-all-coins |
/api/private/get-coin-network | get-coin-network |
/api/private/exchange-coin | exchange-coin |
/api/private/get-transaction | get-transaction |
/api/private/create-transaction | create-transaction |
Available Currencies List
GET:
https://api.pegasusswap.com/api/private/get-all-coins
This API endpoint provides a paginated list of all available currencies.
Parameters:
Name | Type | Required or optional | Description |
---|---|---|---|
page | number | optional | Current page |
limit | number | optional | Limit per page |
search | string | optional | Search by currency name |
method | number | optional | Method 1 we get an array with coins for deposit. Method 2 we get an array with coins for output |
depositCoin | string | optional | Deposit coin |
receiveCoin | string | optional | Receive coin |
depositNetwork | string | optional | Deposit network |
receiveNetwork | string | optional | Receive network |
Successful response fields:
Name | Type | Description |
---|---|---|
pagination: | object | Pagination |
pageCount | number | Page count |
totalCount | number | Total items |
depositCoins / withdrawCoins | array | List with coins |
image | string | Сoin image |
subName | string | Сoin sub name |
name | string | Coin name |
networks | object | Coin networks |
deposits / withdraws | array | Deposits or withdraws networks |
subName | string | Network name |
memoNeeded | boolean | Network has extra ID |
Example request:
GET:
https://api.pegasusswap.com/api/private/get-all-coins?page=1&limit=5&method=1
Example response:
{
"pagination": {
"pageCount": 52,
"totalCount": 260
},
"depositCoins": [
{
"image": "example/USDT.png",
"subName": "USDT",
"name": "TetherUS",
"networks": {
"deposits": [
{
"subName": "TRX",
"memoNeeded": true
}
]
}
}
]
}
Retrieve Currency Networks
GET:
https://api.pegasusswap.com/api/private/get-coin-network
This API endpoint provides the networks associated with a specific currency code.
Parameters:
Name | Type | Required or optional | Description |
---|---|---|---|
coin | string | required | Currency code (Coin sub name) |
Successful response fields:
Name | Type | Description |
---|---|---|
deposit | array | List with deposit networks |
withdraws | array | List with withdraws networks |
subName | string | Sub name network |
Example request:
GET:
https://api.pegasusswap.com/api/private/get-coin-network?coin=eth
Example response:
{
"deposit": [
{
"subName": "ERC20"
}
],
"withdraws": [
{
"subName": "ERC20"
}
]
}
Exchange Pair Information
GET:
https://api.pegasusswap.com/api/private/exchange-coin
This API endpoint provides the amount the user will receive, the current exchange rate
Parameters:
Name | Type | Required or optional | Description |
---|---|---|---|
amount | string | required | Amount of currency you are going to send or get |
coinFrom | string | required | Currency to exchange from |
coinTo | string | required | Currency to exchange to |
networkFrom | string | optional | Network to exchange from |
networkTo | string | optional | Network to exchange to |
lastSource | string | required | We transfer the last input where the data is entered, to the deposit input or the receive input ( for example deposit or receive) |
typeSwap | string | required | 1 - fixed 2 -float |
Successful response fields:
Name | Type | Description |
---|---|---|
pair | string | Exchange pair |
amount | number | Amount sent |
exchangeRate | number | Exchange rate |
receive | number | Amount you will receive |
minAmount | number | Min deposit |
maxAmount | number | Max deposit |
Example request:
GET:
https://api.pegasusswap.com/api/private/exchange-coin?amount=10&coinFrom=eth&coinTo=usdt&lastSource=deposit&typeSwap=1
Example response:
{
"pair": "ETH_USDT",
"amount": "10",
"exchangeRate": 2462.1076313215262,
"receive": 24008.541206617498,
"minAmount": 0.03,
"maxAmount": 2100
}
Retrieve Transaction Information
GET:
https://api.pegasusswap.com/api/private/get-transaction
This API endpoint provides details about a specific transaction.
Parameters:
Name | Type | Required or optional | Description |
---|---|---|---|
id | string | required | Transaction ID |
Successful response fields:
Name | Type | Description |
---|---|---|
type | object | An object containing the type of exchange (fixed or floating rate). |
typeSwap | number | A type of swap where 1 - Fixed, 2 - Float |
pairs | object | An object containing information about coin pairs for deposit and withdrawal |
deposit/receive | object | An object containing information about a coin for deposit and withdrawal |
coin | object | An object containing information out of a coin for deposit and withdrawal |
name | string | Coin name (eg BTC, XMR) |
value | number | The number of coins that will be sent or received |
network | string | The network in which the transaction takes place (eg ERC20, XMR) |
fullName | string | The full name of the coin |
address | string | Address to send or receive coins |
memo | string | Memo for transaction |
receiveTransaction | object | An object containing information about the received transaction |
txId | string | Receive transaction id |
address | string | Address to receive coins |
receivedTime | string | The time the transaction was received |
gettingInTheBlock | string | The time of receiving the first sending confirmation |
amount | number | null | Number of coins sending |
confirmation | number | null | Number of confirmations for the transaction for sending |
fees | number | null | Fees for sending funds |
fees | object | An object containing information about commissions |
feeNodeDeposit | number | Fees for deposit |
swapTime | object | An object containing the exchange time |
end | string | Transaction completion time |
duration | string | Duration of the transaction |
start | string | Transaction start time |
orderNumber | string | The unique identifier of the transaction |
status | number | New - 9; Confirmation - 1; Exchanging - 3; Success - 4, 12; Overdue - 5; Error - 6; Pause - 10; Frozen - 11; Refund - 13 |
txId | string | Deposit transaction id |
riskScore | number | null | Risk assessment for the transaction |
receivedTime | string | Deposit receiving time |
gettingInTheBlock | string | The time of receiving the first deposit confirmation |
confirmation | number | null | Number of confirmations for the transaction for deposit |
Example request:
GET:
https://api.pegasusswap.com/api/private/get-transaction?id=RTGTLN
Example response:
{
"type": {
"typeSwap": 2
},
"pairs": {
"deposit": {
"coin": {
"name": "BTC",
"value": 0.00047,
"network": "BTC",
"fullName": ""
},
"address": "bc1qt3uurp5yjl0s9hpc834nkxx37f99hn5xfqt8x3",
"memo": ""
},
"receive": {
"coin": {
"name": "XMR",
"value": 0.37555349507259705,
"network": "XMR",
"fullName": ""
},
"address": "49ALvhFRnJm4n1JsBG2fiAcrpPXeGEUvrLCvUjXNr9TqLk74pmj9X7s9aprrzRNNWHUgRrYbmysN7Xs8UJijXumPTjV5WVb",
"memo": ""
}
},
"receiveTransaction": {
"txId": "",
"address": "",
"receivedTime": "",
"gettingInTheBlock": "",
"amount": null,
"confirmation": null,
"fees": null
},
"fees": {
"feeNodeDeposit": 0.00009912
},
"swapTime": {
"end": "",
"duration": "",
"start": "1728573590155"
},
"orderNumber": "RBGTSM",
"status": 3,
"txId": "a5398b56b451405bbd2804839100e29709e6f79f993b1ba2e466e952ab7940e4",
"riskScore": null,
"receivedTime": "1726833220",
"gettingInTheBlock": "1728574893",
"confirmation": 5
}
Initiate Transaction
This API endpoint creates a new transaction, generates an address for fund transfer, and returns the transaction details.
POST:
https://api.pegasusswap.com/api/private/create-transaction
Name | Type | Required or optional | Description |
---|---|---|---|
depositCoin | string | required | Coin from deposit |
depositAmount | number | required | Amount from deposit |
depositNetwork | string | required | Address from deposit |
receiveAddress | string | required | Address from receive |
receiveCoin | string | required | Coin from receive |
receiveNetwork | string | required | Network from receive |
typeSwap | number | required | 1 - fixed, 2 -float |
refundAddress | string | optional | Refund address |
memo | string | optional | If needed memo |
lastSource | string | required | Deposit or receive |
Successful response fields:
Name | Type | Description |
---|---|---|
type | object | An object containing the type of exchange (fixed or floating rate) |
typeSwap | number | A type of swap where 1 - Fixed, 2 - Float |
pairs | object | An object containing information about coin pairs for deposit and withdrawal |
deposit/receive | object | An object containing information about a coin for deposit and withdrawal |
coin | object | An object containing information out of a coin for deposit and withdrawal |
name | string | Coin name (eg BTC, XMR) |
value | number | The number of coins that will be sent or received |
network | string | The network in which the transaction takes place (eg ERC20, XMR) |
fullName | string | The full name of the coin |
address | string | Address to send or receive coins |
memo | string | Memo for transaction |
receiveTransaction | object | An object containing information about the received transaction |
txId | string | Receive transaction id |
address | string | Address to receive coins |
receivedTime | string | The time the transaction was received |
gettingInTheBlock | string | The time of receiving the first sending confirmation |
amount | number | null | Number of coins sending |
confirmation | number | null | Number of confirmations for the transaction for sending |
fees | number | null | Fees for sending funds |
fees | object | An object containing information about commissions |
feeNodeDeposit | number | Fees for deposit |
swapTime | object | An object containing the exchange time |
end | string | Transaction completion time |
duration | string | Duration of the transaction |
start | string | Transaction start time |
orderNumber | string | The unique identifier of the transaction |
status | number | New - 9; Confirmation - 1; Exchanging - 3; Success - 4, 12; Overdue - 5; Error - 6; Pause - 10; Frozen - 11; Refund - 13 |
txId | string | Deposit transaction id |
riskScore | number | null | Risk assessment for the transaction |
receivedTime | string | Deposit receiving time |
gettingInTheBlock | string | The time of receiving the first deposit confirmation |
confirmation | number | null | Number of confirmations for the transaction for deposit |
Example request:
POST:
https://api.pegasusswap.com/api/private/create-transaction
Example response:
{
"type": {
"typeSwap": 2
},
"pairs": {
"deposit": {
"coin": {
"name": "BTC",
"value": 0.00047,
"network": "BTC",
"fullName": ""
},
"address": "bc1qt3uurp5yjl0s9hpc834nkxx37f99hn5xfqt8x3",
"memo": ""
},
"receive": {
"coin": {
"name": "XMR",
"value": 0.37555349507259705,
"network": "XMR",
"fullName": ""
},
"address": "49ALvhFRnJm4n1JsBG2fiAcrpPXeGEUvrLCvUjXNr9TqLk74pmj9X7s9aprrzRNNWHUgRrYbmysN7Xs8UJijXumPTjV5WVb",
"memo": ""
}
},
"receiveTransaction": {
"txId": "",
"address": "",
"receivedTime": "",
"gettingInTheBlock": "",
"amount": null,
"confirmation": null,
"fees": null
},
"fees": {
"feeNodeDeposit": 0.00009912
},
"swapTime": {
"end": "",
"duration": "",
"start": "1728573590155"
},
"orderNumber": "RBGTSM",
"status": 3,
"txId": "a5398b56b451405bbd2804839100e29709e6f79f993b1ba2e466e952ab7940e4",
"riskScore": null,
"receivedTime": "1726833220",
"gettingInTheBlock": "1728574893",
"confirmation": 5
}
Errors
Amount to exchange is below the possible min amount to exchange
This error occurs when the amount to exchange is below the possible min amount to exchange
{
"statusCode": 400,
"message": "Amount to exchange is below the possible min amount to exchange"
}
Amount to exchange is higher the possible max amount to exchange
This error occurs when the amount to exchange is higher the possible max amount to exchange
{
"statusCode": 400,
"message": "Amount to exchange is higher the possible max amount to exchange"
}
Invalid withdrawal address:
This error occurs when the specified withdrawal address is invalid or not supported.
{
"statusCode": 400,
"message": "Invalid withdrawal address."
}
Errors about incorrectly passed keys:
Errors about incorrectly passed keys or keys not passed will look like this: Example of an error with the id key
{
"message": [
"id should not be null or undefined",
"id must be a string",
"id should not be empty"
],
"error": "Bad Request",
"statusCode": 400
}
Invalid public key:
This error occurs when an invalid or unknown x-api-public-key is passed in the request headers.
{
"statusCode": 403,
"message": "Invalid public key."
}
Invalid payload:
This error occurs when an invalid or unknown x-api-payload is passed in the request headers.
{
"statusCode": 403,
"message": "Invalid payload."
}
Invalid signature:
This error indicates that the value provided in the x-api-signature header does not match the expected signature. Refer to the documentation on how to correctly generate the x-api-signature.
{
"statusCode": 403,
"message": "Invalid signature."
}
Not found:
This error occurs when the requested data is not found. Please check if the input data is correct.
{
"statusCode": 404,
"message": "Not found."
}
You have exceeded your request limit. Please try again later:
This error occurs when the partner key (x-api-public-key) has exceeded the allowed number of requests within a specific time period. Please try again later.
{
"statusCode": 429,
"message": "You have exceeded your request limit. Please try again later."
}
Error retrieving coins data:
A server-side error indicating that coin data could not be retrieved.
{
"statusCode": 500,
"message": "Error retrieving coins data."
}
Server error:
A general error indicating that something went wrong on the server.
{
"statusCode": 500,
"message": "Server error."
}
Unexpected error:
An unspecified server-side error. Please contact support if the issue persists.
{
"statusCode": 500,
"message": "Unexpected error."
}
Failed to process the request:
An internal error occurred while processing the request.
{
"statusCode": 500,
"message": "Failed to process the request."
}
Failed create transaction:
This error indicates that the server was unable to create a new transaction due to an internal error.
{
"statusCode": 500,
"message": "Failed create transaction."
}