Introduction

SauverExchange REST API

L'API REST SauverExchange permet d'intégrer les fonctionnalités d'échange crypto/fiat dans vos applications. Toutes les réponses sont en JSON (Content-Type: application/json).

URL de base :

BASE URL https://sauverexchange.com/api
Authentification Bearer

Les endpoints protégés (Auth) nécessitent le header Authorization: Bearer {votre_clé_api}. Récupérez votre clé via Mes clés API ou au premier appel POST /auth/login.

Authentification

POST /auth/register Inscription

Crée un compte utilisateur et envoie un code OTP de validation.

Paramètre Type Description
name requis string Nom complet
email requis string Adresse email
phone requis string Numéro de téléphone
country_code requis string Code pays (ex: SN, CI)
password requis string Mot de passe (min 8 car.)
password_confirmation requis string Confirmation du mot de passe
curl -X POST https://sauverexchange.com/api/auth/register \
  -H "Content-Type: application/json" \
  -d '{"name":"Jean Dupont","email":"jean@example.com","phone":"+221771234567","country_code":"SN","password":"secret123","password_confirmation":"secret123"}'
<?php
$ch = curl_init('API_BASE/auth/register');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_HTTPHEADER     => ['Content-Type: application/json'],
    CURLOPT_POSTFIELDS     => json_encode([
        'name'                  => 'Jean Dupont',
        'email'                 => 'jean@example.com',
        'phone'                 => '+221771234567',
        'country_code'          => 'SN',
        'password'              => 'secret123',
        'password_confirmation' => 'secret123',
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('API_BASE/auth/register', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    name: 'Jean Dupont',
    email: 'jean@example.com',
    phone: '+221771234567',
    country_code: 'SN',
    password: 'secret123',
    password_confirmation: 'secret123',
  }),
});
const data = await response.json();
import requests

resp = requests.post('API_BASE/auth/register', json={
    'name': 'Jean Dupont',
    'email': 'jean@example.com',
    'phone': '+221771234567',
    'country_code': 'SN',
    'password': 'secret123',
    'password_confirmation': 'secret123',
})
print(resp.json())

Exemple de réponse

{ "message": "Inscription réussie", "otp_id": 42 }
POST /auth/login Connexion

Authentifie un utilisateur. Retourne un OTP si 2FA actif. La clé API est fournie à la première connexion.

Paramètre Type Description
email requis string Adresse email
password requis string Mot de passe
curl -X POST https://sauverexchange.com/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email":"jean@example.com","password":"secret123"}'
<?php
$ch = curl_init('API_BASE/auth/login');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_HTTPHEADER     => ['Content-Type: application/json'],
    CURLOPT_POSTFIELDS     => json_encode([
        'email'    => 'jean@example.com',
        'password' => 'secret123',
    ]),
]);
$response = json_decode(curl_exec($ch), true);
$apiKey   = $response['api_key'] ?? null; // null si clé déjà émise
curl_close($ch);
const response = await fetch('API_BASE/auth/login', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ email: 'jean@example.com', password: 'secret123' }),
});
const { api_key, otp_id } = await response.json();
// Conservez api_key pour les appels suivants
import requests

resp = requests.post('API_BASE/auth/login', json={
    'email': 'jean@example.com',
    'password': 'secret123',
})
data    = resp.json()
api_key = data.get('api_key')  # None si déjà émise
otp_id  = data.get('otp_id')

Exemple de réponse

{ "message": "OTP envoyé", "otp_id": 7, "api_key": "sxk_live_..." }
POST /auth/validation/{otp_id} Valider le code OTP

Valide le code OTP reçu par SMS/email après connexion ou inscription.

Paramètre Type Description
otp_id requis integer ID OTP (URL)
code requis string Code à 6 chiffres
curl -X POST https://sauverexchange.com/api/auth/validation/7 \
  -H "Content-Type: application/json" \
  -d '{"code":"123456"}'
<?php
$otpId = 7;
$ch = curl_init("API_BASE/auth/validation/{$otpId}");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_HTTPHEADER     => ['Content-Type: application/json'],
    CURLOPT_POSTFIELDS     => json_encode(['code' => '123456']),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const otpId = 7;
const response = await fetch(`API_BASE/auth/validation/${otpId}`, {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ code: '123456' }),
});
const data = await response.json();
import requests

otp_id = 7
resp = requests.post(
    f'API_BASE/auth/validation/{otp_id}',
    json={'code': '123456'}
)
print(resp.json())

Exemple de réponse

{ "message": "Validation réussie", "user": { "id": 1, "name": "Jean Dupont" } }
GET /authentications/detail/get Auth Profil utilisateur

Retourne les informations du compte connecté.

curl -X GET https://sauverexchange.com/api/authentications/detail/get \
  -H "Authorization: Bearer {votre_clé_api}"
<?php
$apiKey = 'votre_clé_api';
$ch = curl_init('API_BASE/authentications/detail/get');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => ["Authorization: Bearer {$apiKey}"],
]);
$user = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('API_BASE/authentications/detail/get', {
  headers: { Authorization: `Bearer ${apiKey}` },
});
const data = await response.json();
resp = requests.get(
    'API_BASE/authentications/detail/get',
    headers={'Authorization': f'Bearer {API_KEY}'}
)
print(resp.json())

Exemple de réponse

{ "id": 1, "name": "Jean Dupont", "email": "jean@example.com", "kyc_level": "none", "role": "user" }

Wallets

GET /currencies/wallet Auth Liste des wallets

Retourne les wallets fiat et les soldes de l'utilisateur.

curl -X GET https://sauverexchange.com/api/currencies/wallet \
  -H "Authorization: Bearer {votre_clé_api}"
<?php
$ch = curl_init('API_BASE/currencies/wallet');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => ['Authorization: Bearer ' . $apiKey],
]);
$wallets = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('API_BASE/currencies/wallet', {
  headers: { Authorization: `Bearer ${apiKey}` },
});
const { wallets } = await response.json();
resp = requests.get(
    'API_BASE/currencies/wallet',
    headers={'Authorization': f'Bearer {API_KEY}'}
)
print(resp.json())

Exemple de réponse

{ "wallets": [{ "id": 1, "currency": "XOF", "balance": "50000.00", "wallet_id": "uuid..." }] }
GET /currencies/wallet/balance Auth Solde total

Retourne le solde global toutes devises confondues.

curl -X GET https://sauverexchange.com/api/currencies/wallet/balance \
  -H "Authorization: Bearer {votre_clé_api}"
<?php
$ch = curl_init('API_BASE/currencies/wallet/balance');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => ['Authorization: Bearer ' . $apiKey],
]);
$balance = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('API_BASE/currencies/wallet/balance', {
  headers: { Authorization: `Bearer ${apiKey}` },
});
const data = await response.json();
resp = requests.get(
    'API_BASE/currencies/wallet/balance',
    headers={'Authorization': f'Bearer {API_KEY}'}
)
print(resp.json())

Exemple de réponse

{ "total_xof": "125000.00", "balances": { "XOF": "50000.00", "EUR": "75.00" } }
POST /currencies/account/transfer Auth Virement fiat

Effectue un virement depuis le wallet de l'utilisateur vers un bénéficiaire.

Paramètre Type Description
wallet_id requis string UUID du wallet source
recipient requis string Numéro ou identifiant du destinataire
amount requis number Montant à transférer
currency requis string Code devise (ex: XOF)
curl -X POST https://sauverexchange.com/api/currencies/account/transfer \
  -H "Authorization: Bearer {votre_clé_api}" \
  -H "Content-Type: application/json" \
  -d '{"wallet_id":"uuid-du-wallet","recipient":"+221771234567","amount":5000,"currency":"XOF"}'
<?php
$ch = curl_init('API_BASE/currencies/account/transfer');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_HTTPHEADER     => [
        'Authorization: Bearer ' . $apiKey,
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS     => json_encode([
        'wallet_id' => 'uuid-du-wallet',
        'recipient' => '+221771234567',
        'amount'    => 5000,
        'currency'  => 'XOF',
    ]),
]);
$result = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('API_BASE/currencies/account/transfer', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${apiKey}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ wallet_id: 'uuid', recipient: '+221771234567', amount: 5000, currency: 'XOF' }),
});
const data = await response.json();
resp = requests.post(
    'API_BASE/currencies/account/transfer',
    headers={'Authorization': f'Bearer {API_KEY}', 'Content-Type': 'application/json'},
    json={'wallet_id': 'uuid', 'recipient': '+221771234567', 'amount': 5000, 'currency': 'XOF'}
)
print(resp.json())

Exemple de réponse

{ "message": "Transfert effectué", "transaction_id": "ref_xxx", "status": "confirmed" }

Trading OTC

GET /platforms/trades/otc/pair Paires OTC disponibles

Liste toutes les paires de trading OTC actives. Endpoint public.

curl -X GET https://sauverexchange.com/api/platforms/trades/otc/pair
<?php
$ch = curl_init('API_BASE/platforms/trades/otc/pair');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$pairs = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('API_BASE/platforms/trades/otc/pair');
const { pairs } = await response.json();
resp = requests.get('API_BASE/platforms/trades/otc/pair')
print(resp.json())

Exemple de réponse

{ "pairs": [{ "id": 1, "from": "USDT", "to": "XOF", "type": "sell", "rate": 635.5 }] }
POST /trade/otc/{type} Auth Obtenir un taux

Calcule le taux et les frais pour une opération OTC. {type} = buy ou sell.

Paramètre Type Description
type requis string buy ou sell (URL)
pair_id requis integer ID de la paire OTC
amount requis number Montant à échanger
curl -X POST https://sauverexchange.com/api/trade/otc/sell \
  -H "Authorization: Bearer {votre_clé_api}" \
  -H "Content-Type: application/json" \
  -d '{"pair_id":1,"amount":100}'
<?php
$ch = curl_init('API_BASE/trade/otc/sell');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_HTTPHEADER     => ['Authorization: Bearer ' . $apiKey, 'Content-Type: application/json'],
    CURLOPT_POSTFIELDS     => json_encode(['pair_id' => 1, 'amount' => 100]),
]);
$rate = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('API_BASE/trade/otc/sell', {
  method: 'POST',
  headers: { Authorization: `Bearer ${apiKey}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({ pair_id: 1, amount: 100 }),
});
const { rate, total, fees } = await response.json();
resp = requests.post(
    'API_BASE/trade/otc/sell',
    headers={'Authorization': f'Bearer {API_KEY}', 'Content-Type': 'application/json'},
    json={'pair_id': 1, 'amount': 100}
)
print(resp.json())

Exemple de réponse

{ "rate": 635.5, "amount_sent": 100, "amount_received": 63550, "fees": 500 }
POST /trade/otc/buysell Auth Exécuter un trade

Crée et exécute une transaction OTC (achat ou vente crypto contre fiat).

Paramètre Type Description
pair_id requis integer ID de la paire OTC
amount requis number Montant à échanger
wallet_id requis string UUID du wallet de paiement
address optionnel string Adresse crypto destinataire (pour achat)
curl -X POST https://sauverexchange.com/api/trade/otc/buysell \
  -H "Authorization: Bearer {votre_clé_api}" \
  -H "Content-Type: application/json" \
  -d '{"pair_id":1,"amount":100,"wallet_id":"uuid-du-wallet"}'
<?php
$ch = curl_init('API_BASE/trade/otc/buysell');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_HTTPHEADER     => ['Authorization: Bearer ' . $apiKey, 'Content-Type: application/json'],
    CURLOPT_POSTFIELDS     => json_encode(['pair_id' => 1, 'amount' => 100, 'wallet_id' => 'uuid']),
]);
$trade = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('API_BASE/trade/otc/buysell', {
  method: 'POST',
  headers: { Authorization: `Bearer ${apiKey}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({ pair_id: 1, amount: 100, wallet_id: 'uuid' }),
});
const trade = await response.json();
resp = requests.post(
    'API_BASE/trade/otc/buysell',
    headers={'Authorization': f'Bearer {API_KEY}', 'Content-Type': 'application/json'},
    json={'pair_id': 1, 'amount': 100, 'wallet_id': 'uuid'}
)
print(resp.json())

Exemple de réponse

{ "transaction_id": "TXN-xxx", "status": "pending", "amount_sent": 100, "amount_received": 63050 }

Paiements

GET /pay/country Auth Pays supportés

Liste les pays disponibles pour les paiements mobile money.

curl -X GET https://sauverexchange.com/api/pay/country \
  -H "Authorization: Bearer {votre_clé_api}"
<?php
$ch = curl_init('API_BASE/pay/country');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => ['Authorization: Bearer ' . $apiKey],
]);
$countries = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('API_BASE/pay/country', {
  headers: { Authorization: `Bearer ${apiKey}` },
});
const { countries } = await response.json();
resp = requests.get('API_BASE/pay/country', headers={'Authorization': f'Bearer {API_KEY}'})
print(resp.json())

Exemple de réponse

{ "countries": [{ "code": "SN", "name": "Sénégal" }, { "code": "CI", "name": "Côte d'Ivoire" }] }
GET /pay/operators/{country} Auth Opérateurs par pays

Liste les opérateurs mobile money disponibles pour un pays (ex: SN, CI).

Paramètre Type Description
country requis string Code pays ISO 2 lettres
curl -X GET https://sauverexchange.com/api/pay/operators/SN \
  -H "Authorization: Bearer {votre_clé_api}"
<?php
$ch = curl_init('API_BASE/pay/operators/SN');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => ['Authorization: Bearer ' . $apiKey],
]);
$operators = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('API_BASE/pay/operators/SN', {
  headers: { Authorization: `Bearer ${apiKey}` },
});
const { operators } = await response.json();
resp = requests.get('API_BASE/pay/operators/SN', headers={'Authorization': f'Bearer {API_KEY}'})
print(resp.json())

Exemple de réponse

{ "operators": [{ "id": 1, "name": "Orange Money", "min": 500, "max": 1000000 }] }
POST /pay/process Auth Initier un paiement

Crée une intention de paiement mobile money (Orange, Wave, MTN…).

Paramètre Type Description
amount requis number Montant
currency requis string Devise (ex: XOF)
operator_id requis integer ID de l'opérateur mobile money
phone requis string Numéro du payeur
wallet_id requis string UUID du wallet à créditer
curl -X POST https://sauverexchange.com/api/pay/process \
  -H "Authorization: Bearer {votre_clé_api}" \
  -H "Content-Type: application/json" \
  -d '{"amount":5000,"currency":"XOF","operator_id":1,"phone":"+221771234567","wallet_id":"uuid"}'
<?php
$ch = curl_init('API_BASE/pay/process');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_HTTPHEADER     => ['Authorization: Bearer ' . $apiKey, 'Content-Type: application/json'],
    CURLOPT_POSTFIELDS     => json_encode([
        'amount'      => 5000,
        'currency'    => 'XOF',
        'operator_id' => 1,
        'phone'       => '+221771234567',
        'wallet_id'   => 'uuid',
    ]),
]);
$payment = json_decode(curl_exec($ch), true);
$ref = $payment['reference'];
curl_close($ch);
const response = await fetch('API_BASE/pay/process', {
  method: 'POST',
  headers: { Authorization: `Bearer ${apiKey}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({ amount: 5000, currency: 'XOF', operator_id: 1, phone: '+221771234567', wallet_id: 'uuid' }),
});
const { reference, redirect_url } = await response.json();
resp = requests.post(
    'API_BASE/pay/process',
    headers={'Authorization': f'Bearer {API_KEY}', 'Content-Type': 'application/json'},
    json={'amount': 5000, 'currency': 'XOF', 'operator_id': 1, 'phone': '+221771234567', 'wallet_id': 'uuid'}
)
reference = resp.json()['reference']

Exemple de réponse

{ "reference": "REF-xxx", "status": "pending", "redirect_url": "https://..." }
GET /pay/check/{reference} Auth Vérifier le statut

Vérifie le statut d'une transaction de paiement par sa référence.

Paramètre Type Description
reference requis string Référence de la transaction (URL)
curl -X GET https://sauverexchange.com/api/pay/check/REF-xxx \
  -H "Authorization: Bearer {votre_clé_api}"
<?php
$ref = 'REF-xxx';
$ch  = curl_init("API_BASE/pay/check/{$ref}");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => ['Authorization: Bearer ' . $apiKey],
]);
$status = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch(`API_BASE/pay/check/REF-xxx`, {
  headers: { Authorization: `Bearer ${apiKey}` },
});
const { status } = await response.json();
resp = requests.get('API_BASE/pay/check/REF-xxx', headers={'Authorization': f'Bearer {API_KEY}'})
print(resp.json())

Exemple de réponse

{ "reference": "REF-xxx", "status": "confirmed", "amount": 5000, "currency": "XOF" }

KYC — Vérification d'identité

GET /documents Auth Types de documents acceptés

Retourne les types de documents acceptés pour la vérification KYC.

curl -X GET https://sauverexchange.com/api/documents \
  -H "Authorization: Bearer {votre_clé_api}"
<?php
$ch = curl_init('API_BASE/documents');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => ['Authorization: Bearer ' . $apiKey],
]);
$types = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('API_BASE/documents', { headers: { Authorization: `Bearer ${apiKey}` } });
const { document_types } = await response.json();
resp = requests.get('API_BASE/documents', headers={'Authorization': f'Bearer {API_KEY}'})
print(resp.json())

Exemple de réponse

{ "document_types": [{ "id": 1, "name": "Carte d'identité nationale", "code": "NID" }] }
POST /documents/users Auth Soumettre des documents KYC

Soumet les documents KYC pour vérification. Requête multipart/form-data — ne pas définir Content-Type.

Paramètre Type Description
document_type_id requis integer ID du type de document
document_number requis string Numéro du document
front_image requis file Photo recto (JPEG/PNG, max 5 MB)
back_image optionnel file Photo verso (optionnel)
curl -X POST https://sauverexchange.com/api/documents/users \
  -H "Authorization: Bearer {votre_clé_api}" \
  -F "document_type_id=1" \
  -F "document_number=AB123456" \
  -F "front_image=@/chemin/recto.jpg" \
  -F "back_image=@/chemin/verso.jpg"
<?php
$ch = curl_init('API_BASE/documents/users');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_HTTPHEADER     => ['Authorization: Bearer ' . $apiKey],
    CURLOPT_POSTFIELDS     => [
        'document_type_id' => 1,
        'document_number'  => 'AB123456',
        'front_image'      => new CURLFile('/chemin/recto.jpg', 'image/jpeg'),
        'back_image'       => new CURLFile('/chemin/verso.jpg', 'image/jpeg'),
    ],
]);
$result = json_decode(curl_exec($ch), true);
curl_close($ch);
const formData = new FormData();
formData.append('document_type_id', '1');
formData.append('document_number', 'AB123456');
formData.append('front_image', frontFile); // File depuis <input type="file">
formData.append('back_image', backFile);

const response = await fetch('API_BASE/documents/users', {
  method: 'POST',
  headers: { Authorization: `Bearer ${apiKey}` }, // PAS de Content-Type
  body: formData,
});
const data = await response.json();
with open('/chemin/recto.jpg', 'rb') as f1, open('/chemin/verso.jpg', 'rb') as f2:
    resp = requests.post(
        'API_BASE/documents/users',
        headers={'Authorization': f'Bearer {API_KEY}'},
        data={'document_type_id': 1, 'document_number': 'AB123456'},
        files={
            'front_image': ('recto.jpg', f1, 'image/jpeg'),
            'back_image':  ('verso.jpg', f2, 'image/jpeg'),
        }
    )
print(resp.json())

Exemple de réponse

{ "message": "Documents soumis", "kyc_id": 15, "status": "pending" }

Crypto Wallet

POST /crypto/wallet/generate Auth Générer un wallet crypto

Génère un nouveau wallet crypto (BIP39/BIP32). Le mnémonique est affiché une seule fois.

Paramètre Type Description
name optionnel string Nom du wallet
curl -X POST https://sauverexchange.com/api/crypto/wallet/generate \
  -H "Authorization: Bearer {votre_clé_api}" \
  -H "Content-Type: application/json" \
  -d '{"name":"Mon wallet principal"}'
<?php
$ch = curl_init('API_BASE/crypto/wallet/generate');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_HTTPHEADER     => ['Authorization: Bearer ' . $apiKey, 'Content-Type: application/json'],
    CURLOPT_POSTFIELDS     => json_encode(['name' => 'Mon wallet principal']),
]);
$wallet   = json_decode(curl_exec($ch), true);
$mnemonic = $wallet['mnemonic']; // ⚠️ Affiché une seule fois — sauvegardez-le
curl_close($ch);
const response = await fetch('API_BASE/crypto/wallet/generate', {
  method: 'POST',
  headers: { Authorization: `Bearer ${apiKey}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Mon wallet principal' }),
});
const { mnemonic, addresses } = await response.json();
// ⚠️ Sauvegardez mnemonic — affiché une seule fois
resp = requests.post(
    'API_BASE/crypto/wallet/generate',
    headers={'Authorization': f'Bearer {API_KEY}', 'Content-Type': 'application/json'},
    json={'name': 'Mon wallet principal'}
)
data     = resp.json()
mnemonic = data['mnemonic']  # ⚠️ Sauvegardez — affiché une seule fois

Exemple de réponse

{ "mnemonic": "word1 word2 ... word12", "addresses": { "BTC": "bc1q...", "ETH": "0x..." } }
GET /crypto/wallet/balances Auth Soldes crypto

Retourne les soldes de tous les actifs crypto du wallet.

curl -X GET https://sauverexchange.com/api/crypto/wallet/balances \
  -H "Authorization: Bearer {votre_clé_api}"
<?php
$ch = curl_init('API_BASE/crypto/wallet/balances');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => ['Authorization: Bearer ' . $apiKey],
]);
$balances = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('API_BASE/crypto/wallet/balances', {
  headers: { Authorization: `Bearer ${apiKey}` },
});
const { balances } = await response.json();
resp = requests.get('API_BASE/crypto/wallet/balances', headers={'Authorization': f'Bearer {API_KEY}'})
print(resp.json())

Exemple de réponse

{ "balances": { "BTC": "0.00123400", "ETH": "0.25000000", "USDT": "150.000000" } }
GET /crypto/wallet/estimate-fee Auth Estimer les frais réseau

Estime les frais réseau avant d'envoyer du crypto.

Paramètre Type Description
symbol requis string Symbole (BTC, ETH, USDT…)
amount requis string Montant à envoyer
to_address requis string Adresse destinataire
curl -X GET "https://sauverexchange.com/api/crypto/wallet/estimate-fee?symbol=ETH&amount=0.1&to_address=0xabc..." \
  -H "Authorization: Bearer {votre_clé_api}"
<?php
$params = http_build_query(['symbol' => 'ETH', 'amount' => '0.1', 'to_address' => '0xabc...']);
$ch = curl_init("API_BASE/crypto/wallet/estimate-fee?{$params}");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => ['Authorization: Bearer ' . $apiKey],
]);
$fees = json_decode(curl_exec($ch), true);
curl_close($ch);
const params = new URLSearchParams({ symbol: 'ETH', amount: '0.1', to_address: '0xabc...' });
const response = await fetch(`API_BASE/crypto/wallet/estimate-fee?${params}`, {
  headers: { Authorization: `Bearer ${apiKey}` },
});
const { fee, fee_usd } = await response.json();
resp = requests.get(
    'API_BASE/crypto/wallet/estimate-fee',
    params={'symbol': 'ETH', 'amount': '0.1', 'to_address': '0xabc...'},
    headers={'Authorization': f'Bearer {API_KEY}'}
)
print(resp.json())

Exemple de réponse

{ "symbol": "ETH", "fee": "0.00021", "fee_usd": "0.65", "estimated_time": "~30s" }
POST /crypto/wallet/send Auth Envoyer du crypto

Signe et diffuse une transaction crypto sur le réseau blockchain.

Paramètre Type Description
symbol requis string Symbole (BTC, ETH, USDT, TRX…)
to_address requis string Adresse destinataire
amount requis string Montant (string pour précision)
fee_rate optionnel string slow / normal / fast
curl -X POST https://sauverexchange.com/api/crypto/wallet/send \
  -H "Authorization: Bearer {votre_clé_api}" \
  -H "Content-Type: application/json" \
  -d '{"symbol":"USDT","to_address":"TXxxxxxxxxxx","amount":"50.00"}'
<?php
$ch = curl_init('API_BASE/crypto/wallet/send');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_HTTPHEADER     => ['Authorization: Bearer ' . $apiKey, 'Content-Type: application/json'],
    CURLOPT_POSTFIELDS     => json_encode([
        'symbol'     => 'USDT',
        'to_address' => 'TXxxxxxxxxxx',
        'amount'     => '50.00',
    ]),
]);
$tx = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('API_BASE/crypto/wallet/send', {
  method: 'POST',
  headers: { Authorization: `Bearer ${apiKey}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({ symbol: 'USDT', to_address: 'TXxxxxxxxxxx', amount: '50.00' }),
});
const { tx_hash, fees } = await response.json();
resp = requests.post(
    'API_BASE/crypto/wallet/send',
    headers={'Authorization': f'Bearer {API_KEY}', 'Content-Type': 'application/json'},
    json={'symbol': 'USDT', 'to_address': 'TXxxxxxxxxxx', 'amount': '50.00'}
)
print(resp.json())

Exemple de réponse

{ "tx_hash": "0xabc...", "fees": "1.50", "status": "broadcasted" }

Adresses de dépôt

GET /deposit/addresses Toutes les adresses de dépôt

Retourne les adresses de dépôt pour tous les actifs crypto supportés. Endpoint public.

curl -X GET https://sauverexchange.com/api/deposit/addresses
<?php
$ch = curl_init('API_BASE/deposit/addresses');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$addresses = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('API_BASE/deposit/addresses');
const { addresses } = await response.json();
resp = requests.get('API_BASE/deposit/addresses')
print(resp.json())

Exemple de réponse

{ "addresses": [{ "symbol": "BTC", "address": "bc1q...", "network": "Bitcoin" }] }
GET /deposit/addresses/{symbol} Adresse par symbole

Retourne l'adresse de dépôt pour un actif crypto spécifique.

Paramètre Type Description
symbol requis string Symbole crypto: BTC, ETH, USDT, TRX…
curl -X GET https://sauverexchange.com/api/deposit/addresses/USDT
<?php
$ch = curl_init('API_BASE/deposit/addresses/USDT');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$info = json_decode(curl_exec($ch), true);
echo $info['address'];
curl_close($ch);
const response = await fetch('API_BASE/deposit/addresses/USDT');
const { address, network } = await response.json();
resp = requests.get('API_BASE/deposit/addresses/USDT')
data = resp.json()
print(f"Adresse USDT: {data['address']}")

Exemple de réponse

{ "symbol": "USDT", "address": "TXxxxxxxxxxx", "network": "TRC-20", "memo": null }
Documentation API - Cryptocurrency Exchange