Skip to main content

API: Request examples

Overview

This documentation provides an overview of the API endpoints, showcasing request and response examples for various operations. All examples use a test environment. Make sure to replace the API key and IDs with the actual values provided to you.

Retrieve a list of integrations

Use this endpoint to retrieve a paginated list of all available integrations. Each integration includes its id, which is required when creating orders.

Request

curl -L 'https://wallet--crypto-demo.d.apicworld.com/api/gateway/api/v1/integrations' \
-H 'Accept: application/json' \
-H 'X-API-Key: db41bf-90f909-b34b52-b7c222-fc1e99'

Response

{
"data": [
{
"name": "test",
"id": "1ef65bda-11ad-63ca-8afe-73770edda314",
"url": "https://example.com",
"status": "active"
}
],
"pagination": {
"quantity": 1,
"totalQuantity": 1,
"currentPage": 1,
"pages": 1
}
}

Get crypto assets

Use this endpoint to retrieve a list of supported crypto assets. Each asset includes identifiers and display information, allowing you to know which assets are available for creating orders.

Request

curl -L 'https://wallet--crypto-demo.d.apicworld.com/api/gateway/api/v1/assets' \
-H 'Accept: application/json' \
-H 'X-API-Key: db41bf-90f909-b34b52-b7c222-fc1e99'

Response

{
"assets": [
{
"id": "USDT_TRC20",
"currencyCode": "USDT",
"displayName": "Tether",
"blockchainId": "tron",
"blockchainDisplayName": "Tron",
"name": "Tether (TRC20)"
},
{
"id": "TRX",
"currencyCode": "TRX",
"displayName": "Tron",
"blockchainId": "tron",
"blockchainDisplayName": "Tron",
"name": "Tron"
}
]
}

Get exchange rates (optionally)

This endpoint should return exchange rates for the requested fiat amount and currency, helping you understand how much crypto you would receive.

Request

curl -L 'https://wallet--crypto-demo.d.apicworld.com/api/gateway/api/v1/exchange-rates?amount=1&currency=USD' \
-H 'Accept: application/json' \
-H 'X-API-Key: db41bf-90f909-b34b52-b7c222-fc1e99'

Response

{
"rates": [
{
"assetId": "USDT_TRC20",
"rate": "1.000460",
"crypto": {
"amount": "1.000460",
"currency": "USDT"
}
},
{
"assetId": "TRX",
"rate": "3.538946",
"crypto": {
"amount": "3.538946",
"currency": "TRX"
}
}
]
}

Incoming order

Incoming orders are orders created to receive funds from a payer.

Create an incoming order

Use the integrationId from the list of integrations and assetId from the crypto assets list to create a payment or deposit order.

Request

curl -L 'https://wallet--crypto-demo.d.apicworld.com/api/gateway/api/v1/order/payment' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'X-API-Key: db41bf-90f909-b34b52-b7c222-fc1e99' \
-d '{
"integrationId": "1ef65bda-11ad-63ca-8afe-73770edda314",
"amount": "1",
"assetId": "TRX",
"externalId": "123"
}'

Response

The response provides the orderId, a paymentLink to a hosted payment page, a widgetCode for embedding the payment widget, and paymentAddress where the payer should send the funds.

{
"orderId": "1efbb7e3-74e3-68a8-a1ca-8ff1ac166f80",
"paymentLink": "https://payment-page.crypto.stage.apicworld.com/payment-page?integrationId=1ef65bda-11ad-63ca-8afe-73770edda314&orderId=1efbb7e3-74e3-68a8-a1ca-8ff1ac166f80",
"widgetCode": "<iframe src=https://payment-page.crypto.stage.apicworld.com/iframe?integrationId=1ef65bda-11ad-63ca-8afe-73770edda314&orderId=1efbb7e3-74e3-68a8-a1ca-8ff1ac166f80 width=\"100%\" height=\"800px\" allow=\"clipboard-write *\" ></iframe>",
"paymentAddress": "TEX8xhRqrpMp73rHktGV8mUpfkSrbxa6Qt"
}

Retrieve a specific order by ID (optional step)

You can fetch the details of a created order using its orderId. This is useful for checking the current status, associated transactions, and amounts.

Request

curl -L 'https://wallet--crypto-demo.d.apicworld.com/api/gateway/api/v1/orders/1efbb7e3-74e3-68a8-a1ca-8ff1ac166f80' \
-H 'Accept: application/json' \
-H 'X-API-Key: db41bf-90f909-b34b52-b7c222-fc1e99'

Response

At this point, the order might still be inProgress if payment hasn't been made.

{
"id": "1efbb7e3-74e3-68a8-a1ca-8ff1ac166f80",
"status": "inProgress",
"createdAt": "2024-12-16T07:20:23+00:00",
"updatedAt": "2024-12-16T07:20:23+00:00",
"transactions": [],
"primaryAmount": {
"amount": "0.000000",
"currency": "TRX"
},
"secondaryAmount": {
"amount": "0.00",
"currency": "EUR"
},
"serviceFeeAmount": {
"amount": "0.000000",
"currency": "TRX"
},
"totalAmount": {
"amount": "0.000000",
"currency": "TRX"
},
"externalId": "123"
}

Payer completes the order

The payer visits the payment page (or uses another method) to send the required cryptocurrency to the given paymentAddress. Once the payment is confirmed, the order status will change to completed.

Retrieve a specific order by ID (after payment is completed)

After the payer sends the funds, you can check the order again to see the updated status and transaction details.

Request

curl -L 'https://wallet--crypto-demo.d.apicworld.com/api/gateway/api/v1/orders/1efbb7e3-74e3-68a8-a1ca-8ff1ac166f80' \
-H 'Accept: application/json' \
-H 'X-API-Key: db41bf-90f909-b34b52-b7c222-fc1e99'

Response

Now the order should be completed and contain transaction details.

{
"id": "1efbb7e3-74e3-68a8-a1ca-8ff1ac166f80",
"status": "completed",
"createdAt": "2024-12-16T07:20:23+00:00",
"updatedAt": "2024-12-16T07:34:04+00:00",
"transactions": [
{
"id": "705",
"hash": "36c8d916bb4f76fe9fc39cee53a5da1fdfc5ed2215940534ba2d1b52f36580de",
"status": "completed",
"createdAt": "2024-12-16T07:32:03+00:00",
"updatedAt": "2024-12-16T07:34:04+00:00",
"receiverAddress": "TEX8xhRqrpMp73rHktGV8mUpfkSrbxa6Qt",
"primaryAmount": {
"amount": "1.000000",
"currency": "TRX"
},
"secondaryAmount": {
"amount": "0.27",
"currency": "EUR"
},
"serviceFeeAmount": {
"amount": "0.005000",
"currency": "TRX"
},
"totalAmount": {
"amount": "0.995000",
"currency": "TRX"
}
}
],
"primaryAmount": {
"amount": "1.000000",
"currency": "TRX"
},
"secondaryAmount": {
"amount": "0.27",
"currency": "EUR"
},
"serviceFeeAmount": {
"amount": "0.005000",
"currency": "TRX"
},
"totalAmount": {
"amount": "0.995000",
"currency": "TRX"
},
"externalId": "123"
}

Retrieve a specific transaction by ID

If you need more details about a particular transaction within an order, use the transaction ID.

Request

curl -L 'https://wallet--crypto-demo.d.apicworld.com/api/gateway/api/v1/orders/1efbb7e3-74e3-68a8-a1ca-8ff1ac166f80/transactions/705' \
-H 'Accept: application/json' \
-H 'X-API-Key: db41bf-90f909-b34b52-b7c222-fc1e99'

Response

The response includes detailed information about that specific transaction, including the blockchain transaction hash.

{
"id": "705",
"orderId": "1efbb7e3-74e3-68a8-a1ca-8ff1ac166f80",
"status": "completed",
"createdAt": "2024-12-16T07:32:03+00:00",
"updatedAt": "2024-12-16T07:34:04+00:00",
"receiverAddress": "TEX8xhRqrpMp73rHktGV8mUpfkSrbxa6Qt",
"primaryAmount": {
"amount": "1.000000",
"currency": "TRX"
},
"secondaryAmount": {
"amount": "0.27",
"currency": "EUR"
},
"serviceFeeAmount": {
"amount": "0.005000",
"currency": "TRX"
},
"totalAmount": {
"amount": "0.995000",
"currency": "TRX"
},
"hash": "36c8d916bb4f76fe9fc39cee53a5da1fdfc5ed2215940534ba2d1b52f36580de",
"externalId": "123"
}

Outgoing orders

Outgoing orders are used to send funds from your balance. They include refunding a previously received payment, making a withdrawal to an external wallet, or sending crypto to another address.

Create a refund order

If you need to issue a refund for a previously completed order, you can create a refund order. Use the orderId of the completed incoming order and specify the amount and destination address.

Request

curl -L 'https://wallet--crypto-demo.d.apicworld.com/api/gateway/api/v1/order/refund' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'X-API-Key: db41bf-90f909-b34b52-b7c222-fc1e99' \
-d '{
"amount": "0.5",
"assetId": "TRX",
"destinationAddress": "TLpYCfo8m77QBu97Xkn1U8nJjcTSfzZpfe",
"refundOrderId": "1efbb7e3-74e3-68a8-a1ca-8ff1ac166f80"
}'

Response

The orderId returned here is the new outgoing refund order. You can track its status similarly to incoming orders.

{
"orderId": "1ef8a105-c8c5-6798-bd66-d325f4066d2f"
}

Create a withdrawal order

If you need to withdraw funds from your account balance to an external wallet, create a withdrawal order. Ensure that the integrationId you use corresponds to the one that manages the balance you want to withdraw from.

Request

curl -L 'https://wallet--crypto-demo.d.apicworld.com/api/gateway/api/v1/order/withdrawal' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'X-API-Key: db41bf-90f909-b34b52-b7c222-fc1e99' \
-d '{
"amount": "1",
"assetId": "TRX",
"destinationAddress": "TLpYCfo8m77QBu97Xkn1U8nJjcTSfzZpfe",
"integrationId": "1ef65bda-11ad-63ca-8afe-73770edda314"
}'

Response

The returned orderId can be used to track the withdrawal order’s status.

{
"orderId": "1ef8a10a-cba0-6418-9a3e-e99641328dac"
}

Send crypto

If you want to send crypto from one of your managed addresses to another address, use this endpoint.

Request

curl -L 'https://wallet--crypto-demo.d.apicworld.com/api/gateway/api/v1/order/send' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'X-API-Key: db41bf-90f909-b34b52-b7c222-fc1e99' \
-d '{
"amount": "1.20",
"assetId": "TRX",
"transferAddress": "TKrzGg5YHerPLypmVq5pb525oDe451mbtM",
"destinationAddress": "TAQZdD8skUdAChM48383TY2LrMWtr6xzc5",
"integrationId": "1ef65bda-11ad-63ca-8afe-73770edda314",
"externalId": "123"
}'

Response

{
"orderId": "1efbb83e-4262-6518-93bd-dfb836b62a9a",
"transactionId": "709"
}