Getting started

Quickstart

This page walks through a complete order with an SDK: quote, create, look up, and receive status callbacks.

1. Create an API key

  1. Sign up and log in at speed.cc.
  2. Open “API” from the avatar menu at the top right and click “New key”.
  3. Enter a callback URL (for status callbacks) and an IP whitelist (your server's outbound IPs are recommended).
  4. Save the API key and Secret that appear. The Secret is shown only once — store it somewhere safe right away.

Keep the Secret on your server only. Never put it in web pages, apps or any code that ships to user devices.

2. Install an SDK

Download the package for your language from the SDKs page.

npm install ./speed-sdk-js-1.0.0.tgz

3. Get a quote

const { SpeedClient } = require('speed-sdk')

const speed = new SpeedClient({
  apiKey: process.env.SPEED_API_KEY,
  apiSecret: process.env.SPEED_API_SECRET
})

const quote = await speed.rate({ from: 'USDT', fromNetwork: 'TRC20', to: 'BTC', toNetwork: 'Bitcoin', amount: '1000' })
console.log(quote.receiveAmount)   // estimated amount received, after all fees

4. Create an order

Set clientOrderId to the order ID in your own system. If a request times out, retry with the same clientOrderId and you get the same order back.

const order = await speed.createOrder({
  fromCurrency: 'USDT', fromNetwork: 'TRC20',
  toCurrency: 'BTC', toNetwork: 'Bitcoin',
  amount: '1000',
  recipientAddress: 'bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh',
  clientOrderId: 'shop-1001'
})
// Ask the user to send order.sendAmount USDT (TRC20) to order.depositAddress

Show depositAddress, sendAmount (and depositMemo, if present) to the user and ask them to pay before expireAt.

5. Receive status callbacks

When an order's status changes we send a POST request to your callback URL. Always verify using the raw request body.

const express = require('express')
const { verifyWebhook } = require('speed-sdk')
const app = express()

app.post('/speed/webhook', express.raw({ type: 'application/json' }), (req, res) => {
  let event
  try {
    event = verifyWebhook(process.env.SPEED_API_SECRET, req.get('X-SPEED-TIMESTAMP'), req.get('X-SPEED-SIGN'), req.body)
  } catch (e) {
    return res.status(401).send('bad signature')
  }
  if (event.event === 'order.status') {
    // update your order using event.order.clientOrderId
  }
  res.send('ok')
})

Click “Test callback” under “API” to send a ping event to your callback URL and confirm verification works.

Go-live checklist

  • The Secret is stored only on your server and is not committed to source control.
  • An IP whitelist is configured.
  • Every order has a unique clientOrderId, and timeouts are retried with the same value.
  • All amounts are handled as strings and never converted to floating point.
  • Callbacks are verified with the raw request body, and you return HTTP 2xx after processing.
  • Callback handling is idempotent: a repeated event never books twice.
  • You handle ACTION_REQUIRED, ON_HOLD, EXPIRED and other non-happy-path states.
  • For networks with depositMemo, your UI clearly tells users to include the memo.
  • On 42900 you slow down and back off before retrying.

Need help with your integration? Contact support: [email protected]