API
Démarrage
Les données soumises doivent être encodées en UTF-8.
Pour que les requêtes API aboutissent, toutes les requêtes doivent inclure plusieurs en-têtes requis:
- L’en-tête X-API-KEY doit contenir la clé API reçue (YOUR_API_KEY)
Pour que les requêtes API aboutissent, toutes les requêtes doivent inclure plusieurs en-têtes requis:
- L’en-tête X-API-KEY doit contenir la clé API reçue (YOUR_API_KEY)
Exemple de requête
bash
curl -X GET \
-H "x-api-key: YOUR_API_KEY" \
"https://xgram.io/api/v1/METHOD"
-H "x-api-key: YOUR_API_KEY" \
"https://xgram.io/api/v1/METHOD"
Toutes les requêtes envoyées à l’API Xgram doivent inclure le paramètre key (clé API), disponible après inscription à notre programme de partenariat.
Validation d’adresse
Cette requête vérifie la validité de l’adresse:
https://xgram.io/api/v1/crypto-address-verification Paramètre
Paramètre
Type
Exemple
cryptoDigitalCoin
string
BTC
cryptoDigitalAddress
string
bc1q6aas41krwvvcc4hhio6u4euf1y3wkbtap8uhmrt
Exemple de requête
bash
curl -X GET "https://xgram.io/api/v1/crypto-address-verification?cryptoDigitalCoin=BTC&cryptoDigitalAddress=bc1q6aas41krwvvcc4hhio6u4euf1y3wkbtap8uhmrt" \
-H "x-api-key: bc1qvi55hg9rlwc2etpoypkt98db37vcbto5fke0a6w" \
-H "Content-Type: application/json; charset=UTF-8"
Exemple de réponse
json
{
"result": true
}Taux de change pour le montant de la transaction
Cette requête permet d’obtenir le taux de change actuel. Les frais de transaction ne sont pas inclus:
https://xgram.io/api/v1/retrieve-rate-value Paramètre
Paramètre
Type
Exemple
fromCcy
string
BTC
toCcy
string
ETH
ccyAmount
float
1
Exemple de requête
bash
curl -X GET "https://xgram.io/api/v1/retrieve-rate-value?fromCcy=BTC&toCcy=ETH&ccyAmount=1" \
-H "x-api-key: bc1qvi55hg9rlwc2etpoypkt98db37vcbto5fke0a6w" \
-H "Content-Type: application/json; charset=UTF-8"
Exemple de réponse
json
{
"fix": false,
"minFrom": "0.0081",
"maxFrom": "138",
"from_network": "Bitcoin",
"to_network": "ERC20",
"rate": 25.084395813448847,
"withdrawalFee": "0.006 ETH",
"result": true
}* withdrawalFee - Frais de retrait approximatifs. Paramètre flottant.
Obtenir la liste des devises
Obtenir toutes les devises activées:
https://xgram.io/api/v1/list-currency-options Exemple de requête
bash
curl -X GET "https://xgram.io/api/v1/list-currency-options" \
-H "x-api-key: bc1qvi55hg9rlwc2etpoypkt98db37vcbto5fke0a6w" \
-H "Content-Type: application/json; charset=UTF-8"
Exemple de réponse
json
{
"XETA": {"coinName": "XANA",
"contract": "0x111111111117dc0aa78b770fa6a738034120c302",
"minFrom": 19137.93103448276,
"maxFrom": 18773946,
"tagname": "",
"network": "AVAXC",
"available": true
},"FITFI": {"coinName": "Step App",
"contract": "",
"minFrom": 16989.79591836735,
"maxFrom": 14965986,
"tagname": "",
"network": "AVAXC",
"available": true
},"ARB": {"coinName": "Arbitrum",
"contract": "",
"minFrom": 90.68627450980394,
"maxFrom": 88085,
"tagname": "",
"network": "Arbitrum",
"available": true
},"KLAY": {"coinName": "Klaytn",
"contract": "",
"minFrom": 389.9297423887589,
"maxFrom": 69838833,
"tagname": "",
"network": "Klaytn",
"available": true
},...
}Si le
tagname n’est pas vide, ce tag est un paramètre obligatoire pour cette devise.Liste des paires
Cette requête permet d’obtenir toutes les paires disponibles pour l’échange:
https://xgram.io/api/v1/load-pairs-options Exemple de requête
bash
curl -X GET "https://xgram.io/api/v1/load-pairs-options" \
-H "x-api-key: bc1qvi55hg9rlwc2etpoypkt98db37vcbto5fke0a6w" \
-H "Content-Type: application/json; charset=UTF-8"
Exemple de réponse
json
[
[
"ETH",
"LTC"
],
[
"BTC",
"BCH"
],
[
"ZEC",
"BAT"
],
[
"ETH",
"USDT"
],
[
"BNB",
"XRP"
],
]Initialisation de l’échange
Cette requête crée et initie l’échange:
https://xgram.io/api/v1/launch-new-exchange Paramètre
Paramètre
Type
Exemple
toAddress
string
0xaeeee8f61f3ccffe8c60e7aed0f4ca753e0ba43d
toAddressTag
optionnel
string
refundAddress
optionnel
string
bc1q8dj6psgvmqshkgy9vpl7shtn2ly77qz5dr6mq3
refundTag
optionnel
string
fromCcy
string
BTC
toCcy
string
ZEC
ccyAmount
float
0.5
type
optionnel
string
float
Valeurs valides : float et fixed
Exemple de requête
bash
curl -X GET "https://xgram.io/api/v1/launch-new-exchange?toAddress=0x750c44dB01899176f2e64bD25A2fabAC1140d8e9&fromCcy=BTC&toCcy=ETH&ccyAmount=0.5" \
-H "x-api-key: bc1qvi55hg9rlwc2etpoypkt98db37vcbto5fke0a6w" \
-H "Content-Type: application/json; charset=UTF-8"
Exemple de réponse
json
{
"id": "qeqb36r5qa999th0",
"depositAddress": "2Q4J7Kz90S6yI5fWb1T8LzR9U3eM4vXxC7H",
"depositTag": "",
"result": true,
"ccyAmountToExpected": 14.7316,
}Initialisation du paiement
Cette requête crée et initie le paiement:
https://xgram.io/api/v1/launch-new-payment-exchange Paramètre
Paramètre
Type
Exemple
toAddress
string
0xaeeee8f61f3ccffe8c60e7aed0f4ca753e0ba43d
toAddressTag
optionnel
string
refundAddress
optionnel
string
bc1q8dj6psgvmqshkgy9vpl7shtn2ly77qz5dr6mq3
refundTag
optionnel
string
fromCcy
string
BTC
toCcy
string
ZEC
ccyAmount
float
0.5
type
optionnel
string
float
Valid values: float and fixed
Exemple de requête
bash
curl -X GET "https://xgram.io/api/v1/launch-new-payment-exchange?toAddress=0x750c44dB01899176f2e64bD25A2fabAC1140d8e9&fromCcy=BTC&toCcy=ETH&ccyAmount=0.5" \
-H "x-api-key: bc1qvi55hg9rlwc2etpoypkt98db37vcbto5fke0a6w" \
-H "Content-Type: application/json; charset=UTF-8"
Exemple de réponse
json
{
"id": "qeqb36r5qa999th0",
"depositAddress": "2Q4J7Kz90S6yI5fWb1T8LzR9U3eM4vXxC7H",
"depositTag": "",
"result": true,
"ccyAmountFrom": 0.0183883
}Obtenir le statut de l’échange
Obtenir des informations sur le statut actuel de l’échange:
https://xgram.io/api/v1/fetch-status-info Paramètre
Paramètre
Type
Exemple
id
string
qeq6r5qa999th0
Exemple de requête
bash
curl -X GET "https://xgram.io/api/v1/fetch-status-info?id=qeq6r5qa999th0" \
-H "x-api-key: bc1qvi55hg9rlwc2etpoypkt98db37vcbto5fke0a6w" \
-H "Content-Type: application/json; charset=UTF-8"
Exemple de réponse
json
{
"x-status": "deposit_received",
"id": "qeq6r5qa999th0",
"x-fromCcy": "BTC",
"x-toCcy": "ZEC",
"x-ccyDepositAddress": "1Z9VcAgLPQwoAb7fiWuDKZbqwnt5LKrAv",
"x-ccyDepositTag": "",
"x-ccyDepositHash": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2w3x4y5z6a7b8c9d0e1f2g3h",
"x-ccyDestinationAddress":"2Q4J7Kz90S6yI5fWb1T8LzR9U3eM4vXxC7H","x-ccyDestinationTag": "",
"x-ccyRefundAddress":"2B2yQ2fQ6RHejg3ENQUgUM6TMn8e8WjGqOb","x-ccyRefundTag": "",
"x-ccyExpectedAmountFrom": 0.5,
"x-ccyExpectedAmountTo": 50.02,
"x-ccyAmountFrom": "0.5",
"date": "21.01.2024 10:01:11",
"txId": null,
"x-ccyAmountTo": null,
"result": true
}Liste des statuts utilisés :
x-new - nouvelle transaction (en attente de dépôt) x-awaiting_funds - confirmation du dépôt x-funds_received - dépôt reçu x-processing_exchange - échange en cours x-transferring - en cours d’envoi x-completed - échange terminé avec succès x-timeout - le délai d’attente des fonds a expiré x-error - l’échange s’est terminé avec une erreur x-transfer_error - échec de la tentative d’envoi x-returned - les fonds ont été retournés au client