Documentation

SwyDex exposes a single REST API + WebSocket gateway. The snippets below cover the most common flows. Full per-endpoint reference is available at /docs/api.

Authentication

Every API request takes an API key + secret pair, generated from /api-keys.

curl https://api.swydex.com/api/v1/wallets \
  -H "X-API-Key: cs_live_..." \
  -H "X-API-Secret: ..."

Wallet API

Create deterministic wallets per user, on any supported chain. Auto-sweep into your master wallet.

await fetch('https://api.swydex.com/api/v1/wallets', {
  method: 'POST',
  headers: { 'X-API-Key': '...', 'X-API-Secret': '...', 'Content-Type': 'application/json' },
  body: JSON.stringify({
    externalId: 'user_123',
    network: 'ethereum',
  }),
});

Exchange API

Quote and execute swaps. Cross-chain via DEX aggregators when no internal liquidity is available.

await fetch('https://api.swydex.com/api/v1/swaps/quote', {
  method: 'POST',
  headers: { 'X-API-Key': '...', 'X-API-Secret': '...', 'Content-Type': 'application/json' },
  body: JSON.stringify({
    fromWalletId: 'wal_...',
    fromAsset: 'USDC',
    toAsset: 'USDT',
    toContract: null,    // optional: ERC-20 contract for non-native targets
    fromAmount: '100',
  }),
});

P2P API

List buy/sell ads, escrow trades, raise disputes. Real-time updates via the WebSocket gateway.

await fetch('https://api.swydex.com/api/v1/p2p/trades', {
  method: 'POST',
  headers: { 'X-API-Key': '...', 'X-API-Secret': '...', 'Content-Type': 'application/json' },
  body: JSON.stringify({
    adId: 'ad_...',
    buyerProfileId: 'prof_...',
    amount: '500',
    paymentMethod: 'bank_transfer',
  }),
});

Payment Gateway

Dynamic deposit-address-per-checkout. Generate a fresh address for each invoice, default 1-hour expiry, real-time confirmation via webhooks. See /applications#payment-gateway for the full pattern.

await fetch('https://api.swydex.com/api/v1/payments/checkouts', {
  method: 'POST',
  headers: { 'X-API-Key': '...', 'X-API-Secret': '...', 'Content-Type': 'application/json' },
  body: JSON.stringify({
    externalId: 'order_12345',
    network: 'tron',
    amountExpected: '5000000',  // 5 USDT in base units
    expiresInSeconds: 3600,
    successUrl: 'https://yourapp.com/success',
  }),
});
// Returns: { id, address, amountExpected, expiresAt, status: 'PENDING' }

Webhooks

Subscribe to deposit / withdrawal / sweep events. Every payload is HMAC-signed with your webhook secret.

// Verify on your end:
import crypto from 'crypto';
const expected = crypto.createHmac('sha256', WEBHOOK_SECRET)
  .update(rawBody).digest('hex');
if (signature !== expected) return res.status(401).end();

Need help integrating?

We're happy to walk through your integration on a call.

Talk to an engineer