NAV Navbar
shell

Introduction

XanPool REST API allows to integrate users' on/off boarding on your website with a custom interface. Below your will find endpoints for users' as well transactions' managment.

API Authorization

XanPool uses API keys to allow access to the API. Our API is open only to a limited number of trusted partners, if you would like to find out more please contact us via xl@xanpool.com.

User scoped endpoints support OAuth2 authentication as well as HTTP Basic Authentication. We encourage you to use token based authenticated(OAuth2) wherever is possible

OAuth2

We strongly encourage our partners to use token based authentication which is supported by all endpoints(except POST /api/users). Token is passed in Authorization header as Authorization: Bearer {MY ACCESS TOKEN}. There are two ways you can get an access token:

  1. Through Redirect & Authorization Code
  2. By executing POST /users/oauth2/user-token (if you have already access to a certain user and his id).

Redirect

Redirect your user to https://xanpool.com/http://authorize?clientId={YOUR API KEY}&redirectUrl={PAGE AFTER SUCCESSFUL AUTHORIZATION} On this page a user will be prompted to authorize your app. After successful authorization he will be redirected to your redirectUrl with the parameter code (i.e. https://okex.com/success?authorizationCode=1xseh1j2u91nb12gsna1). Use this authorizationCode in the following step.

Authorization Code Exchange

curl "https://xanpool.com/api/oauth2/oauth2/token"
  -X POST  
  -u {YOUR API KEY}:{YOUR PASSWORD}
  -d '{"code":"1xseh1j2u91nb12gsna1"}'

Upon successful request you receive a similar response:

{
  "accessToken": "1e1e1dad4b5b685900124e87121dad41e1dad4b5b685900124e8712b5b685900124e8711e1dad4b5b685900124e87122"
}

Use the authorizationCode received in the previous step and exchange it to user scoped accessToken to get access to user's account.

Access Token for authorized account

curl "https://xanpool.com/api/oauth2/oauth2/user-token"
  -X POST  
  -u {YOUR API KEY}:{YOUR PASSWORD}
  -d '{"userId":"1xseh1j2u91nb12gsna11111"}'

Upon successful request you receive a similar response:

{
  "accessToken": "1e1e1dad4b5b685900124e87121dad41e1dad4b5b685900124e8712b5b685900124e8711e1dad4b5b685900124e87122"
}

If you know a user's ID and this user has authorized your app(or you created this user) use this endpoint to get access token.

HTTP Request

POST /api/oauth2/user-token

Payload attributes

Parameter Description
userId ID of the user

User Control

In order to create a transaction you need to access to a verified user's account. Below you will find all required endpoints for creating users and verifying them(KYC). All user's related endpoints can be executed on behalf of the partner that created a provided user.

Sign Up

curl "https://xanpool.com/api/users"
  -X POST  
  -u {YOUR API KEY}:{YOUR PASSWORD}
  -d '{"email":"example@xanpool.com", "firstName":"Daniel", "lastName": "Taiger"}'

Upon successful sign up you receive a similar response:

{
  "id": "1e1dad4b5b685900124e8712",
  "email": "peter@xanpool.com",
  "firstName": "Daniel",
  "lastName": "Taiger",
  "kyc": "not-verified"
}

Creates a new user on behalf of a partner.

HTTP Request

POST /api/users

Payload attributes

Parameter Description
email Email of the user.
firstName First name of the user
lastName Last name of the user

Set Phone Number

curl "https://xanpool.com/api/users/{id}/phone"
  -X PUT  
  -H "Authorization: Bearer ${TOKEN}"  
  -d '{"phone":"87711111", "code": "+65"}'

If everything is alright you will get response like this

{
  "status": "ok"
}

Initiates phone's verification, the first part of KYC process. Developer must provide a valid user's phone number (including country's code starting with +), XanPool will send a confirmation code to the number.

HTTP Request

PUT /api/users/{id}/phone

Payload attributes

Parameter Description
phone A valid phone number without country code
code Country of the country starting with +

Verify Phone Number

curl "https://xanpool.com/api/users/{id}/phone/verify"
  -X PUT  
  -H "Authorization: Bearer ${TOKEN}"  
  -d '{"code": 123456}'

If everything is alright you will get response like this

{
  "id": "1e1dad4b5b685900124e8712",
  "email": "peter@xanpool.com",
  "firstName": "Daniel",
  "lastName": "Taiger",
  "kyc": "not-verified",
  "phone": "+6587711111"
}

Completes phone verification if the provided code is correct. User has 5 attempts.

HTTP Request

PUT /api/users/{id}/phone

Payload attributes

Parameter Description
phone A valid phone number without country code
code Country of the country starting with +

Upload KYC Documents

curl "https://xanpool.com/api/users/{id}/upload-kyc-documents"
  -X POST  
  -H "Authorization: Bearer ${TOKEN}"  
  -F "type=front"
  -F "filename=front.jpg"  
  -F "file=@front.jpg"

If everything is alright you will get response like this

{
  "status": "ok"
}

Users must provide a valid ID, it could be passport or national ID. Developers must ensure a high quality of the image. Frontside of the ID, Proof of address, Kyc Video are required. Backside of ID is optional. Supported types for documents are are pdf, jpg, png, jpeg. Supported types for KYC video are all video formats.

HTTP Request

POST /api/users/{id}/upload-kyc-documents

Form attributes

Payload should be application/x-www-form-urlencoded type

Parameter Description
file A binary file of the provided document
filename Name of the file
type Must be either front, back, addressProof, kycVideo

Initiate KYC request

curl "https://xanpool.com/api/users/{id}/verify"
  -X PUT  
  -H "Authorization: Bearer ${TOKEN}"  
  -d "{"address": "Singapore, Princep Street 128, #01-01"}"

If everything is alright you will get response like this

{
  "id": "1e1dad4b5b685900124e8712",
  "email": "peter@xanpool.com",
  "firstName": "Daniel",
  "lastName": "Taiger",
  "kyc": "in-progress",
  "phone": "+6587711111"
}

The last step in KYC process is providing user's address. Once this request has been sent, XanPool will start user's verification which usually it takes ~ 30 minutes.

HTTP Request

PUT /api/users/{id}/verify

Payload attributes

Parameter Description
address User's address

Transactions

Bellow you can find endpoints for managing users' transactions. These endpoins are available only for users which kyc status is either in-progress or verified. If user's status is in-progress, XanPool will fix the price during KYC process and will release crypto/fiat upon successful verification.

Create buying transaction

# buying btc
curl "https://xanpool.com/api/users/{userId}/transactions"
  -X POST  
  -H "Authorization: Bearer ${TOKEN}"  
  -d "{"type": "buy", "fiat": 100, "method": "paynow", "cryptoCurrency": "BTC", "wallet": "1GJR22e15dDSTF3M3c4uwchY1wAoyt5Tm8"}"

If everything is alright you will get response like this

{
    "id": "5e1fcb31632fcd001206cbd5",
    "type": "buy",
    "status": "pending",
    "method": "paynow",
    "crypto": 0.008583,
    "fiat": 100,
    "total": 0.008411,
    "currency": "SGD",
    "cryptoCurrency": "BTC",
    "serviceCharge": 0.000172,
    "cryptoPrice": 11650.87038,
    "cryptoPriceUsd": 8655.6,
    "nonce": "yard",
    "qrCode: "00020101021126380009SG.PAYNOW010100211877671920301052040000530370254040.015802SG5902NA6009Singapore62110107hallway6304E484",
    "peer": {
        "account": "+6586667192"
    }
}

Creates a transaction to purchase crypto.

HTTP Request

POST /api/users/{userId}/transactions

Payload attributes for buying transaction

Parameter Default Description
type none "buy"
fiat none Amount in local currency
method none ID of one of the supported methods
cryptoCurrency none ["btc", "zil"]
wallet none Crypto wallet where Xanpool will transfer purchased crypto

Response attributes for buying transaction

Parameter Description
total Final amount of crypto user will get. Gets finalized after receiving fiat.
nonce A string that the user must attach to his transaction
qrCode QR code(depends on the method) that can be used for paying this transaction.
peer An object with account information where the user should send the fiat

Create selling transaction

# selling btc
curl "https://xanpool.com/api/users/{userId}/transactions"
  -X POST  
  -H "Authorization: Bearer ${TOKEN}"  
  -d "{"type": "sell", "crypto": 0.1, "method": "paynow", "cryptoCurrency": "BTC", "methodAttributes" : {"phone": "87761111", "code": "+65"}}"

If everything is alright you will get response like this

{
    "id": "5e1fca5adf1be500129ffbe0",
    "type": "selling",
    "status": "pending",
    "method": "paynow",
    "crypto": 0.1,
    "fiat": 1164.33,
    "total": 1129.4,
    "currency": "SGD",
    "cryptoCurrency": "BTC",
    "serviceCharge": 0.003,
    "cryptoPrice": 11643.3325,
    "cryptoPriceUsd": 8650,
    "depositWallets": {
        "bitcoin": "bc1q394vqe6he7jrv8ad35vhgeu2vnzs606ykmx4c4",
        "legacyBitcoin": "1KgXh9aRWnxZpAwqQqM8n9KDrZw2Aju2sa"
    }
}

Creates a selling crypto transaction

HTTP Request

POST /api/transactions

Payload attributes

Parameter Default Description
type none "sell"
crypto none Amount in crypto you're selling
method none Id of one of the supported methods
cryptoCurrency none ["btc", "usdt"]
methodAttributes none Depends on the method, contains information where XanPool will send fiat

MethodAttributes attributes

Required attributes vary for each payment method, please find below required attributes for each method supported by XanPool.

Methods Parameter Description
Paynow, AliPayHK, PromptPay, Viettel Pay, Go Jek, FPS phone, code Phone & country code
Bank Transfers, InstaPay bank, account, accountName Bank account information
UPI accountName Account name for an UPI account

Response attributes for buying transaction

Parameter Description
total Final amount of fiat the user will get. Becomes final after state BTC_IN_MEMPOOL
depositWallets Deposit wallets' addresses where user must send crypto. Currently 3 values: bitcoin(Bech32), legacyBitcoin, ethereum(Erc20 tokens & Ethereum)

Get Transaction

curl "https://xanpool.com/api/transactions/{id}"
 -H "Authorization: Bearer ${TOKEN}"

If everything is alright you will get response like this

{
    "id": "5e1fca5adf1be500129ffbe0",
    "status": "pending",
    "method": "paynow",
    "type": "sell",
    "crypto": 0.1,
    "fiat": 1164.33,
    "total": 1129.4,
    "currency": "SGD",
    "cryptoCurrency": "BTC",
    "serviceCharge": 0.003,
    "cryptoPrice": 11643.3325,
    "cryptoPriceUsd": 8650,
    "userId": "7c089db6018ed51324c020cd",
    "depositWallets": {
        "bitcoin": "bc1q394vqe6he7jrv8ad35vhgeu2vnzs606ykmx4c4",
        "legacyBitcoin": "1KgXh9aRWnxZpAwqQqM8n9KDrZw2Aju2sa"
    }
}

This endpoint is used for getting transaction's information, you can execute it to get the updates.

HTTP Request

GET /api/transactions/{id}

Estimate Transaction

curl 
-H "Content-Type: application/json" 
-X POST "https://xanpool.com/api/transactions/estimate" 
-d '{"type": "buy", "crypto": 0.007, "method": "paynow", "cryptoCurrency": "BTC"}'

If everything is alright you will get response like this

{
  "crypto":0.007,
  "fiat":69.62,
  "cryptoPrice":9946.058850000001,
  "cryptoPriceUsd":7371,
  "total":0.00686,
  "serviceCharge":0.00014,
  "referralDiscount":0,
  "referralDiscountInXlp":0,
  "referralDiscountInUsd":0,
  "payoutServiceCharge":0,
  "earnedXlp":3.9198910024610143,
  "processingTime":"5-30 minutes",
  "currency":"SGD"
}

Use this endpoint to estimate a transaction

HTTP Request

POST /api/transactions/estimate

Payload attributes

Parameter Default Description
type none Required. "sell" or "buy"
cryptoCurrency none Required. Value from ["BTC", "ZIL", "USDT"]
method none Optional. ID of one of the supported methods
currency none Optional. Fiat Currency. Either this field or method must be specified
fiat none Optional. Either fiat or crypto must be specified
crypto none Optional. Either fiat or crypto must be specified

Misc

A collection of endpoints that will help you with integration XanPool REST API.

Get list of supported Methods & Limits

# create a request
curl 
-H "Content-Type: application/json"
"https://xanpool.com/api/methods"

If everything is alright you will get response like this

{
   "buy":[
      {
         "country":"SG",
         "currency":"SGD",
         "methods":[
            {
               "method":"paynow",
               "max":1000,
               "min":40,
               "name":"PayNow"
            }
         ]
      },
      {
         "country":"HK",
         "currency":"HKD",
         "methods":[
            {
               "method":"fps",
               "max":3000,
               "min":300,
               "name":"FPS"
            },
            {
               "method":"alipay-hk",
               "max":3000,
               "min":300,
               "name":"Alipay HK"
            }
         ]
      },
      {
         "country":"TH",
         "currency":"THB",
         "methods":[
            {
               "method":"prompt-pay",
               "max":5000,
               "min":1000,
               "name":"Prompt Pay"
            }
         ]
      },
      {
         "country":"PH",
         "currency":"PHP",
         "methods":[
            {
               "method":"instapay",
               "max":10000,
               "min":1500,
               "name":"InstaPay"
            }
         ]
      },
      {
         "country":"IN",
         "currency":"INR",
         "methods":[
            {
               "method":"upi",
               "max":30000,
               "min":3000,
               "name":"UPI"
            }
         ]
      },
      {
         "country":"ID",
         "currency":"IDR",
         "methods":[
            {
               "method":"gojek-id",
               "max":2000000,
               "min":400000,
               "name":"GoJek"
            }
         ]
      },
      {
         "country":"VN",
         "currency":"VND",
         "methods":[
            {
               "method":"viettel-pay",
               "max":9000000,
               "min":800000,
               "name":"Viettel Pay"
            }
         ]
      }
   ],
   "sell":[
      {
         "country":"SG",
         "currency":"SGD",
         "methods":[
            {
               "method":"paynow",
               "max":1000,
               "min":40,
               "name":"PayNow"
            }
         ]
      },
      {
         "country":"HK",
         "currency":"HKD",
         "methods":[
            {
               "method":"fps",
               "max":3000,
               "min":300,
               "name":"FPS"
            }
         ]
      },
      {
         "country":"PH",
         "currency":"PHP",
         "methods":[
            {
               "method":"instapay",
               "max":10000,
               "min":1500,
               "name":"InstaPay"
            },
            {
               "method":"cebuana-lhuillier-ph",
               "max":30000,
               "min":1500,
               "name":"Cebuana"
            },
            {
               "method":"palawan-pawnshop-ph",
               "max":20000,
               "min":1500,
               "name":"Palawan"
            }
         ]
      },
      {
         "country":"NG",
         "currency":"NGN",
         "methods":[
            {
               "method":"bank-transfer-ng",
               "max":300000,
               "min":10000,
               "name":"Bank Transfer"
            }
         ]
      },
      {
         "country":"VN",
         "currency":"VND",
         "methods":[
            {
               "method":"bank-transfer-vn",
               "max":20000000,
               "min":100000,
               "name":"Bank Transfer"
            }
         ]
      },
      {
         "country":"ID",
         "currency":"IDR",
         "methods":[
            {
               "method":"bank-transfer-id",
               "max":11000000,
               "min":500000,
               "name":"Bank Transfer"
            }
         ]
      },
      {
         "country":"GH",
         "currency":"GHS",
         "methods":[
            {
               "method":"bank-transfer-gh",
               "max":4000,
               "min":200,
               "name":"Bank Transfer"
            }
         ]
      },
      {
         "country":"IN",
         "currency":"INR",
         "methods":[
            {
               "method":"upi",
               "max":30000,
               "min":3000,
               "name":"UPI"
            }
         ]
      }
   ]
}

Returns the list of supported methods in each country as well as the limit.

HTTP Request

GET /api/methods

Get list of supported Cryptocurrencies

curl 
-H "Content-Type: application/json"
"https://xanpool.com/api/cryptocurrencies"

If everything is alright you will get response like this

{"sell":["BTC","USDT"],"buy":["BTC","ZIL"]}

Returns the list of supported cryptocurrencies.

HTTP Request

GET /api/cryptocurrencies

Checkout

Use this endpoint to manage request ids for checkout.xanpool.com page, more info here

Create a request

# create a request
curl 
-H "Content-Type: application/json"
-X POST "https://xanpool.com/api/requests" 
-u {API_KEY}:{PASSWORD} 
-d '{"type": "buy", "cryptoCurrency": "BTC", "wallet": "194iAtCQ1JbsuEdPwcgnMPbrosHMtUupAY"}' 

If everything is alright you will get response like this

{
  "id": "5d089db6018ed51324c020ce",
  "type": "buy",
  "cryptoCurrency": "BTC",
  "wallet": "194iAtCQ1JbsuEdPwcgnMPbrosHMtUupAY",
  "status": "initiated"
}

This endpoints allows to create a checkout request(not a transaction!) that can be used on checkout.xanpool.com later. Please note, in order to execute this endpoint, you need to be authenticated as a partner via basic auth.

HTTP Request

POST /api/requests

Payload attributes

Parameter Default Description
type none Optional. "sell" or "buy"
cryptoCurrency none Optional. Value from ["BTC", "ZIL", "USDT"]
currency none Optional. Fiat currency
wallet none Optional. Wallet for buying transactions
autoSelling none Optional. If you would like to send crypto to Xp wallet. true or false

Get a request

# Get a request
curl "https://xanpool.com/api/requests/5d089db6018ed51324c020ce"
  -u {YOUR-API-KEY}:{YOUR-PASSWORD}  

If everything is alright you will get response like this

{
  "id": "5d089db6018ed51324c020ce",
  "type": "buy",
  "cryptoCurrency": "BTC",
  "wallet": "194iAtCQ1JbsuEdPwcgnMPbrosHMtUupAY",
  "status": "created",
  "transactionId": "1d089db6018ed51324c020ce",
  "transaction": {
    "userId": "7c089db6018ed51324c020cd",
    "crypto": 0.03,
    "cryptoCurrency": "BTC",
    "currency": "SGD",
    "fiat": 298.00,
    "serviceCharge": 0.0006,
    "total": 0.0294,
    "cryptoPrice": 9933.38,
    "cryptoPriceUsd": 7361.28,
    "status": "completed",
    "blockchainTxId": "1d6d4ab1ce77274f5ac80ddfda554af2d124b4d6a40cfeb079a574c5c54b7d46"
    }
}

This endpoints allows to get request information including it's status. Currently two states are supported: initiated - initial state, created - when a user created a transaction, in this case transaction object will be included to the response, please note, you need to be authenticated to get this information.

HTTP Request

GET /api/requests/{id}

Constants

Transaction's status

Here is the list of possible statuses.

Status Description
PENDING A user just created a transaction
COMPLETED the final successful state, either crypto or fiat has been sent to the user
FIAT_RECEIVED Received fiat from the user when he is buying crypto
FIAT_RECEIVED_NOT_FULL User has sent not enough fiat, this transaction will be moderated, and fiat will be sent back.
BTC_IN_MEMPOOL Crypto has reached the mempool during selling
BTC_RECEIVED Reached enough confirmations
EXPIRED_FIAT_NOT_RECEIVED Hasn't received fiat from the user within a time window.
EXPIRED_BTC_NOT_IN_MEMPOOL Hasn't received crypto from the user within a time window.
PAYOUT_FAILED Couldn't sent fiat to user. transaction will be moderated
PAYOUT_FAILED_INTERNAL Couldn't sent fiat to user. transaction will be moderated(Same as above)

Supported Methods

Each method has minimum and maximum limits. Please use /api/methods endpoint for the latest supported methods

Method Method ID Fiat Currency Min limit Max Limit
Paynow paynow SGD 50 1000
PromptPay prompt-pay THB 1000 5000
UPI upi INR 2500 30000
InstaPay instapay PHP 2000 10000
Viettel Pay viettel-pay VND 800000 9000000
GoJek(GoPay) gojek-id IDR 500000 2000000
AliPay Hong Kong alipay-hk HKD 200 3000
FPS fps HKD 200 3000
DuitNow duit-now MYR 140 1000

Currencies' Precision

Below you can find precision for each currency used on XanPool during transactions, this precision doesn't apply to pairs' prices, for instance, USDT/SGD could be shown as 1.442 for user's convenience.

Currency Fraction part
BTC 6 digits
ETH 3 digits
ZIL 2 digits
USDT 2 digits
IDR no fraction part
VND no fraction part
SGD 2 digits
HKD 2 digits
THB 2 digits
INR 2 digits
MYR 2 digits
PHP 2 digits