SMSCode SDKs
Official TypeScript, JavaScript, and Python SDKs for the SMSCode virtual-number API.
Rent temporary phone numbers, receive OTP/SMS verification codes, and automate phone verification flows.
Why SMSCode SDKs
- One public API contract for TypeScript/JavaScript and Python, validated against the same OpenAPI source.
- Money-safe order creation with idempotency keys, typed errors, and retry behavior designed for paid API calls.
- OTP lifecycle helpers for waiting, resending, finishing, capability-gated cancellation, and verifying webhook signatures.
/v2 USD-native API by default, with the legacy /v1 IDR API still available where needed.
Packages
Quick Start
TypeScript / JavaScript
npm i @smscode/sdk
import { SmscodeClient } from "@smscode/sdk";
const client = new SmscodeClient({ token: process.env.SMSCODE_TOKEN! });
const { balance } = await client.balance.get();
console.log(`USD balance: ${balance.amount}`);
Python
pip install smscode
import os
from smscode import SmscodeClient
with SmscodeClient(token=os.environ["SMSCODE_TOKEN"]) as client:
balance = client.balance.get()
print(f"USD balance: {balance.balance.amount}")
Supported Workflows
- Catalog lookup for countries, services, products, and exchange rates.
- Balance reads on
/v2 and /v1.
- Order create, list, get, cancel, finish, resend, and active-order lookup.
- OTP polling with code and revision baselines after resend (
afterCode +
afterRevision / after_code + after_revision).
- Delivered text/link-only SMS is exposed as
otp_code=null plus otp_message; after a wait timeout, re-read can_finish/can_cancel before acting.
- Webhook get/update/test plus raw-body signature verification helpers.
- Typed error classes for validation, auth, rate limit, timeout, terminal order, and money/idempotency failures.
Documentation
Repository Layout
packages/sdk-js/ TypeScript/JavaScript SDK
packages/sdk-py/ Python SDK
docs/ Public API and AI-agent documentation
scripts/ Contract and release verification helpers
License
MIT — see LICENSE.
评论