TypeScript & Node.js SDK
@managebetcodes/sdknpm install @managebetcodes/sdkOn this page
How to install the TypeScript SDK
npm install @managebetcodes/sdkInstall with npm install @managebetcodes/sdk: the @managebetcodes/sdk package on npm runs on Node 18 and later, is typed for modern JavaScript runtimes, and must run on the server, never in browser code.
How to create a TypeScript client and convert a code
Create a client with new Client(process.env.MBC_API_KEY!) and call await client.convert("7B9A2F", "sportybet", "1xng") to convert a SportyBet code to 1xBet NG. Keep the key in a server environment variable: the SDK is for server-side Node and must never ship the key in browser code.
import { Client } from "@managebetcodes/sdk";
const client = new Client(process.env.MBC_API_KEY!);
const result = await client.convert("7B9A2F", "sportybet", "1xng");
console.log(result.target.code);Which methods the TypeScript SDK provides
The Manage Bet Codes TypeScript SDK covers convert, view, viewImage, split, merge, book, eventsSearch, events, eventMarkets, resolve, markets, books, capabilities, usage, history, jobs, and live tracking. Each method maps to the same /v1 route and billing as the raw REST call, with server-side key handling.
client.convert(code, source, target, options)client.convertToAll(code, source, options)client.convertBulk(codes, options)client.view(code, bookmaker)client.viewImage(code, bookmaker)client.split(code, bookmaker, options)client.merge(pairs, options)client.book(bookmaker, options)client.eventsSearch(bookmaker, queries, options)client.events(query)client.eventMarkets(eventId, query)client.resolve(bookmaker, picks, options)client.markets()client.books(query)client.capabilities()client.usage()client.history(query)client.jobsCreate(payload, options)client.job(jobId)client.jobs(query)client.cancelJob(jobId)client.trackStart(code, bookmaker, options)client.track(trackId)client.tracks(query)client.stopTrack(trackId)
How the TypeScript SDK retries, paginates, and verifies webhooks
The Manage Bet Codes TypeScript SDK retries 429, 502, 503, and 504 with Retry-After backoff, raises typed errors for auth, quota, rate limit, validation, and API faults, paginates history, jobs, books, and search, downloads images as bytes, verifies X-MBC-Signature webhooks, and supports a configurable base URL and timeout, all on server-side Node.
- Retry on 429, 502, 503, and 504. Honor
Retry-After. - Typed errors for auth, quota, rate limit, validation, and API failures.
- Pagination for history, jobs, books, and search.
- Image download as bytes.
- Webhook signature verification for
X-MBC-Signature. - Configurable base URL and timeout.
Which HTTP request the TypeScript SDK sends
The Manage Bet Codes TypeScript await client.convert("7B9A2F", "sportybet", "1xng") sends POST /v1/convert with {"code": "7B9A2F", "from": "sportybet", "to": "1xng"} and the X-API-Key header from the server environment. Read convert for the full response and errors for the error envelope.
POST /v1/convert
{"code": "7B9A2F", "from": "sportybet", "to": "1xng"}