Dokumentasi API OTPexpress.
Panduan lengkap untuk mengintegrasikan OTPexpress ke aplikasi, bot, atau backend Anda. Semua endpoint pakai Bearer token dan mengembalikan JSON konsisten.
Pengenalan
API OTPexpress dirancang untuk developer yang butuh verifikasi nomor virtual secara programatik.
Setiap request harus menyertakan Authorization: Bearer di header. Semua respons dalam JSON dengan struktur { success, data } atau { success: false, error }.
Cakupan
- Katalog negara, layanan, dan produk dengan harga real-time
- Buat dan kelola order nomor virtual
- Polling status OTP sampai kode masuk
- Finish atau cancel order sesuai kondisi
Autentikasi
Setiap request API wajib menyertakan Bearer token di header Authorization.
Authorization: Bearer otpx_live_xxxxxxxxxxxxAPI key memiliki prefix otpx_live_ dan di-generate dari dashboard. Jangan pernah menaruh API key di kode frontend yang bisa dilihat publik.
Rotasi Key
Kalau key bocor, revoke di API Keys dan generate yang baru. Aplikasi yang masih pakai key lama akan otomatis gagal (401).
Base URL
Semua endpoint relatif terhadap base URL berikut.
https://www.otpexpress.my.id/api/v1Contoh Lengkap
https://www.otpexpress.my.id/api/v1/meFormat Respons
Semua respons mengikuti struktur envelope yang konsisten.
Sukses
{
"success": true,
"data": { ... }
}Gagal
{
"success": false,
"error": {
"code": "INSUFFICIENT_BALANCE",
"message": "Saldo tidak mencukupi."
}
}Selalu branch pada error.code (enum stabil), bukan pada error.message.
Rate Limit
Batas permintaan untuk memastikan kestabilan API.
| Limit | Nilai | Keterangan |
|---|---|---|
| requests/min | 60 | per API key, bucket 60 detik |
| orders/aktif | 10 | maksimal order pending per akun |
Header respons menyertakan info rate limit:
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 43
X-RateLimit-Reset: 2026-10-01T12:34:56.000ZInfo Akun
Mengembalikan info akun dan API key yang sedang dipakai.
Contoh Request
curl https://www.otpexpress.my.id/api/v1/me \
-H "Authorization: Bearer otpx_live_xxxxx"Contoh Response
{
"success": true,
"data": {
"account": {
"email": "user@example.com",
"name": "Administrator",
"balance_idr": 75000,
"created_at": "2026-09-01T08:00:00.000Z"
},
"api_key": {
"id": "550e8400-...",
"name": "Bot Produksi",
"prefix": "otpx_live_a1b2",
"last_used_at": "2026-10-01T10:00:00.000Z"
}
}
}Daftar Negara
Mengembalikan daftar negara yang tersedia untuk nomor virtual.
Contoh Request
curl https://www.otpexpress.my.id/api/v1/countries \
-H "Authorization: Bearer otpx_live_xxxxx"Contoh Response
{
"success": true,
"data": {
"countries": [
{ "id": 7, "code": "ID", "name": "Indonesia", "dial_code": "+62", "emoji": "🇮🇩" },
{ "id": 6, "code": "MY", "name": "Malaysia", "dial_code": "+60", "emoji": "🇲🇾" }
],
"total": 120
}
}Daftar Layanan
Daftar layanan (aplikasi/platform) yang tersedia untuk negara tertentu.
| Parameter | Tipe | Deskripsi |
|---|---|---|
| country_id required | integer | ID negara dari /countries. |
Contoh Request
curl "https://www.otpexpress.my.id/api/v1/services?country_id=7" \
-H "Authorization: Bearer otpx_live_xxxxx"Contoh Response
{
"success": true,
"data": {
"services": [
{ "id": 45, "code": "dana", "name": "DANA" },
{ "id": 3, "code": "wa", "name": "WhatsApp" }
],
"total": 1700
}
}Daftar Produk
Daftar paket dengan harga final (sudah termasuk markup). Harga di price_idr adalah yang Anda bayar.
| Parameter | Tipe | Deskripsi |
|---|---|---|
| country_id required | integer | ID negara. |
| platform_id required | integer | ID layanan dari /services. |
| operator_id optional | integer | ID operator kalau mau filter spesifik. |
Contoh Response
{
"success": true,
"data": {
"products": [
{
"catalog_product_id": 488,
"name": "DANA Indonesia",
"country_id": 7,
"platform_id": 45,
"operator_id": null,
"operator_name": null,
"available": 42,
"price_idr": 1500
}
],
"total": 3
}
}Buat Order
Membuat order nomor virtual baru. Saldo otomatis terpotong setelah order berhasil dibuat.
Body Parameters
| Field | Tipe | Deskripsi |
|---|---|---|
| catalog_product_id required | integer | ID dari /products. |
| country_id required | integer | ID negara. |
| country_name required | string | Nama negara (untuk display). |
| platform_id required | integer | ID layanan. |
| platform_name required | string | Nama layanan (untuk display). |
| operator_id optional | integer | ID operator kalau pakai yang spesifik. |
| operator_name optional | string | Nama operator (display). |
| price_idr required | integer | Harga final dari /products. |
Contoh Request
curl -X POST https://www.otpexpress.my.id/api/v1/orders \
-H "Authorization: Bearer otpx_live_xxxxx" \
-H "Content-Type: application/json" \
-d '{
"catalog_product_id": 488,
"country_id": 7,
"country_name": "Indonesia",
"platform_id": 45,
"platform_name": "DANA",
"price_idr": 1500
}'Contoh Response
{
"success": true,
"data": {
"order": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"smscode_order_id": "16087654321",
"status": "pending",
"phone_number": null,
"price_idr": 1500,
"created_at": "2026-10-01T10:00:00.000Z"
}
}
}Cek Status Order
Cek status order dan OTP. Panggil berkala (polling) sampai otp_code terisi.
Contoh Request
curl https://www.otpexpress.my.id/api/v1/orders/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer otpx_live_xxxxx"Contoh Response (OTP sudah masuk)
{
"success": true,
"data": {
"order": {
"id": "550e8400-...",
"smscode_order_id": "16087654321",
"status": "otp_received",
"phone_number": "6285655746606",
"otp_code": "9559",
"otp_message": "AWAS PENIPUAN! ... Kode OTP: 9559",
"price_idr": 1500,
"created_at": "2026-10-01T10:00:00.000Z"
}
}
}Status Enum
| Status | Artinya |
|---|---|
| pending | Order dibuat, nomor belum siap |
| waiting | Nomor aktif, menunggu SMS |
| otp_received | Kode OTP sudah masuk |
| finished | Order selesai (kode dipakai) |
| canceled | Dibatalkan, saldo di-refund |
| expired | Kedaluwarsa tanpa SMS |
| failed | Gagal di sistem |
Selesaikan Order
Tutup order setelah OTP dipakai. Setelah finished, order tidak bisa dibatalkan.
curl -X POST https://www.otpexpress.my.id/api/v1/orders/550e8400-.../finish \
-H "Authorization: Bearer otpx_live_xxxxx"Batalkan Order
Batalkan order yang belum menerima OTP. Saldo otomatis di-refund penuh.
Kode Error
Semua error punya code yang stabil — selalu branch di code, bukan message.
| Code | HTTP | Artinya |
|---|---|---|
| UNAUTHORIZED | 401 | Token tidak ada atau invalid |
| RATE_LIMIT_EXCEEDED | 429 | Lebih dari 60 req/menit |
| TOO_MANY_ACTIVE_ORDERS | 429 | Sudah 10 order aktif |
| VALIDATION_ERROR | 400 | Body/query tidak valid |
| INSUFFICIENT_BALANCE | 402 | Saldo tidak cukup |
| NOT_FOUND | 404 | Resource tidak ada |
| CONFLICT | 409 | State resource tidak sesuai |
| UPSTREAM_ERROR | 502 | Provider SMS sibuk |
| INTERNAL_ERROR | 500 | Kesalahan tak terduga |
Contoh Lengkap
Alur end-to-end: buat order → polling OTP → finish.
const BASE = 'https://www.otpexpress.my.id/api/v1';
const KEY = process.env.OTPEXPRESS_KEY;
async function main() {
// 1) Buat order
const create = await fetch(BASE + '/orders', {
method: 'POST',
headers: {
Authorization: 'Bearer ' + KEY,
'Content-Type': 'application/json',
},
body: JSON.stringify({
catalog_product_id: 488,
country_id: 7,
country_name: 'Indonesia',
platform_id: 45,
platform_name: 'DANA',
price_idr: 1500,
}),
});
const { data } = await create.json();
const orderId = data.order.id;
console.log('Order dibuat:', orderId);
// 2) Polling sampai OTP masuk (max 60 detik)
for (let i = 0; i < 20; i++) {
await new Promise(r => setTimeout(r, 3000));
const r = await fetch(BASE + '/orders/' + orderId, {
headers: { Authorization: 'Bearer ' + KEY },
});
const j = await r.json();
if (j.data.order.otp_code) {
console.log('OTP:', j.data.order.otp_code);
// 3) Finish
await fetch(BASE + '/orders/' + orderId + '/finish', {
method: 'POST',
headers: { Authorization: 'Bearer ' + KEY },
});
return;
}
}
throw new Error('Timeout menunggu OTP');
}
main().catch(console.error);Prompt AI Agent
Copy-paste prompt di bawah ini ke ChatGPT, Claude, atau Codex untuk generate integrasi otomatis.
Kamu adalah engineer yang mengintegrasikan OTPexpress API ke aplikasi Node.js.
BASE URL: https://www.otpexpress.my.id/api/v1
AUTH: Authorization: Bearer <OTPEXPRESS_KEY>
Alur yang harus diimplementasikan:
1. GET /countries → pilih negara berdasarkan country_name
2. GET /services?country_id=X → pilih layanan (WhatsApp/Telegram/dll)
3. GET /products?country_id=X&platform_id=Y → pilih paket termurah dengan stok > 0
4. POST /orders → kirim catalog_product_id, country_id, country_name, platform_id, platform_name, price_idr
5. GET /orders/:id polling setiap 3 detik sampai response.data.order.otp_code tidak null (max 20x)
6. POST /orders/:id/finish → tutup order setelah OTP dipakai
Rules:
- Env variable OTPEXPRESS_KEY untuk Bearer token
- Handle error.code: UNAUTHORIZED, RATE_LIMIT_EXCEEDED, INSUFFICIENT_BALANCE, TOO_MANY_ACTIVE_ORDERS, NOT_FOUND, CONFLICT, UPSTREAM_ERROR
- Response format: { success: boolean, data?: any, error?: { code, message } }
- Rate limit: 60 req/menit per API key
- Retry dengan exponential backoff untuk UPSTREAM_ERROR dan RATE_LIMIT_EXCEEDED
Output: file tunggal index.js dengan fungsi:
- main() yang menjalankan alur end-to-end
- log setiap langkah ke console
- handle error dengan jelasBuat wrapper Python untuk OTPexpress API dengan struktur: BASE URL: https://www.otpexpress.my.id/api/v1 AUTH: Authorization: Bearer <OTPEXPRESS_KEY> Buat class OTPExpress: - __init__(api_key) → simpan token - countries() → list negara - services(country_id) → list layanan - products(country_id, platform_id) → list produk - create_order(catalog_product_id, country_id, country_name, platform_id, platform_name, price_idr) → buat order - get_order(order_id) → cek status - wait_for_otp(order_id, timeout=60) → polling otomatis - finish_order(order_id) → selesaikan - cancel_order(order_id) → batalkan Handle: - Raise OTPExpressError(code, message) untuk error response - Auto retry 3x untuk network error dengan exponential backoff - Session reuse via requests.Session Output: single file otpexpress.py plus contoh penggunaan di main.py
SDK Resmi
SDK untuk mempermudah integrasi tanpa boilerplate.
TypeScript / JavaScript
npm i @otpexpress/sdk
# atau
bun add @otpexpress/sdk
# atau
yarn add @otpexpress/sdkimport { OTPExpress } from '@otpexpress/sdk';
const client = new OTPExpress({ apiKey: process.env.OTPEXPRESS_KEY! });
const order = await client.orders.create({
catalog_product_id: 488,
country_id: 7,
country_name: 'Indonesia',
platform_id: 45,
platform_name: 'DANA',
price_idr: 1500,
});
const { otp_code } = await client.orders.waitForOtp(order.id, { timeoutMs: 60_000 });
console.log('OTP:', otp_code);
await client.orders.finish(order.id);Python
pip install otpexpressfrom otpexpress import OTPExpress
import os
client = OTPExpress(api_key=os.environ['OTPEXPRESS_KEY'])
order = client.orders.create(
catalog_product_id=488,
country_id=7,
country_name='Indonesia',
platform_id=45,
platform_name='DANA',
price_idr=1500,
)
result = client.orders.wait_for_otp(order['id'], timeout=60)
print('OTP:', result['otp_code'])
client.orders.finish(order['id'])OpenAPI Spec
Spec lengkap dalam format OpenAPI 3.1 — bisa diimport ke Postman, Insomnia, atau dijadikan generator SDK.
https://www.otpexpress.my.id/api/openapiImport ke Postman
- Buka Postman → File → Import → Link
- Paste https://www.otpexpress.my.id/api/openapi
- Postman otomatis generate semua endpoint
- Set environment variable api_key dengan Bearer token Anda
Generate SDK Otomatis
# Pakai openapi-generator
openapi-generator-cli generate \
-i https://www.otpexpress.my.id/api/openapi \
-g typescript-fetch \
-o ./otpexpress-client