Dokumentasi API
API Endpoint Reference
Referensi lengkap NEXOTP API v1. Setiap endpoint berisi fungsi, authentication, parameter, request body, response sukses, error umum, implementation notes, dan contoh kode multi-bahasa.
Base URL
Gunakan domain production Anda sebagai base URL. Semua endpoint di bawah memakai prefix API v1 dan membutuhkan Authorization header.
/api/v1/balanceGet wallet balance
Mengambil saldo wallet akun yang sedang digunakan. Gunakan endpoint ini sebelum membuat order untuk memastikan saldo cukup.
Authentication
Required. Bearer API key production atau sandbox.
Success Response
{
"success": true,
"data": {
"balance": 2450000,
"currency": "IDR",
"updatedAt": "2026-06-22T06:00:00.000Z"
},
"requestId": "req_01HX..."
}Error Response
401API key tidak valid atau tidak dikirim.
429Request melebihi limit.
Catatan Implementasi
- Saldo selalu dibaca dari ledger internal.
- Nilai balance dikembalikan dalam satuan rupiah tanpa pemisah ribuan.
Contoh CURL
curl -X GET "https://webnokosai.vercel.app/api/v1/balance" \
-H "Authorization: Bearer nx_live_xxx"Contoh JavaScript
const res = await fetch('https://webnokosai.vercel.app/api/v1/balance', {
headers: { Authorization: 'Bearer nx_live_xxx' }
});
const data = await res.json();Contoh PHP
$ch = curl_init('https://webnokosai.vercel.app/api/v1/balance');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer nx_live_xxx']
]);
$response = curl_exec($ch);Contoh Python
import requests
res = requests.get(
'https://webnokosai.vercel.app/api/v1/balance',
headers={'Authorization': 'Bearer nx_live_xxx'}
)
print(res.json())/api/v1/servicesList services
Mengambil daftar layanan OTP yang tersedia untuk order. Data ini dipakai untuk menampilkan pilihan aplikasi atau platform kepada user.
Authentication
Required. Bearer API key production atau sandbox.
Query parameters
qstringOpsional. Filter nama layanan.
limitnumberOpsional. Jumlah data maksimum.
Success Response
{
"success": true,
"data": [
{
"serviceCode": "whatsapp",
"name": "WhatsApp",
"category": "messaging",
"available": true
}
],
"requestId": "req_01HX..."
}Error Response
401API key tidak valid.
503Katalog layanan sedang tidak tersedia.
Catatan Implementasi
- Simpan cache singkat di aplikasi Anda untuk mengurangi request berulang.
- Gunakan serviceCode saat membuat order.
Contoh CURL
curl -X GET "https://webnokosai.vercel.app/api/v1/services" \
-H "Authorization: Bearer nx_live_xxx"Contoh JavaScript
const res = await fetch('https://webnokosai.vercel.app/api/v1/services', {
headers: { Authorization: 'Bearer nx_live_xxx' }
});
const services = await res.json();Contoh PHP
$ch = curl_init('https://webnokosai.vercel.app/api/v1/services');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer nx_live_xxx']
]);
$response = curl_exec($ch);Contoh Python
import requests
res = requests.get(
'https://webnokosai.vercel.app/api/v1/services',
headers={'Authorization': 'Bearer nx_live_xxx'}
)
print(res.json())/api/v1/countriesList countries
Mengambil daftar negara yang dapat digunakan untuk order nomor virtual. Gunakan countryCode pada request order.
Authentication
Required. Bearer API key production atau sandbox.
Query parameters
servicestringOpsional. Filter negara berdasarkan layanan tertentu.
Success Response
{
"success": true,
"data": [
{
"countryCode": "id",
"name": "Indonesia",
"prefix": "+62",
"available": true
}
],
"requestId": "req_01HX..."
}Error Response
401API key tidak valid.
400Filter service tidak dikenali.
Catatan Implementasi
- Country code menggunakan format lowercase.
- Ketersediaan dapat berubah sesuai stok dan provider.
Contoh CURL
curl -X GET "https://webnokosai.vercel.app/api/v1/countries?service=whatsapp" \
-H "Authorization: Bearer nx_live_xxx"Contoh JavaScript
const res = await fetch('https://webnokosai.vercel.app/api/v1/countries?service=whatsapp', {
headers: { Authorization: 'Bearer nx_live_xxx' }
});
const countries = await res.json();Contoh PHP
$ch = curl_init('https://webnokosai.vercel.app/api/v1/countries?service=whatsapp');
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ['Authorization: Bearer nx_live_xxx']]);
$response = curl_exec($ch);Contoh Python
import requests
res = requests.get(
'https://webnokosai.vercel.app/api/v1/countries',
params={'service': 'whatsapp'},
headers={'Authorization': 'Bearer nx_live_xxx'}
)
print(res.json())/api/v1/providersList providers
Mengambil daftar provider yang tersedia untuk kombinasi layanan dan negara. Gunakan providerCode untuk memilih provider spesifik.
Authentication
Required. Bearer API key production atau sandbox.
Query parameters
servicestringOpsional. Service code.
countrystringOpsional. Country code.
Success Response
{
"success": true,
"data": [
{
"providerCode": "any",
"name": "Any Provider",
"price": 6500,
"stock": 120
}
],
"requestId": "req_01HX..."
}Error Response
401API key tidak valid.
400Parameter service atau country tidak valid.
Catatan Implementasi
- Gunakan provider any untuk pemilihan otomatis.
- Harga pada response sudah mengikuti pricing rule akun Anda.
Contoh CURL
curl -X GET "https://webnokosai.vercel.app/api/v1/providers?service=whatsapp&country=id" \
-H "Authorization: Bearer nx_live_xxx"Contoh JavaScript
const url = new URL('https://webnokosai.vercel.app/api/v1/providers');
url.searchParams.set('service', 'whatsapp');
url.searchParams.set('country', 'id');
const res = await fetch(url, { headers: { Authorization: 'Bearer nx_live_xxx' } });Contoh PHP
$ch = curl_init('https://webnokosai.vercel.app/api/v1/providers?service=whatsapp&country=id');
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ['Authorization: Bearer nx_live_xxx']]);
$response = curl_exec($ch);Contoh Python
import requests
res = requests.get(
'https://webnokosai.vercel.app/api/v1/providers',
params={'service': 'whatsapp', 'country': 'id'},
headers={'Authorization': 'Bearer nx_live_xxx'}
)
print(res.json())/api/v1/orderCreate order
Membuat order nomor virtual baru. Sistem akan memvalidasi saldo, menghitung harga final, membuat order, dan mengembalikan nomor jika tersedia.
Authentication
Required. Bearer API key production atau sandbox.
Request body
servicestringWajib. Service code.
countrystringWajib. Country code.
providerstringOpsional. Provider code, default any.
idempotencyKeystringDisarankan. Mencegah order ganda saat retry.
Success Response
{
"success": true,
"data": {
"orderId": "ord_01HX...",
"status": "waiting",
"phoneNumber": "+62812xxxxxxx",
"price": 6500,
"expiresAt": "2026-06-22T06:15:00.000Z"
},
"requestId": "req_01HX..."
}Error Response
400Body request tidak lengkap.
402Saldo tidak cukup.
409Idempotency key sudah dipakai untuk payload berbeda.
503Nomor tidak tersedia.
Catatan Implementasi
- Selalu gunakan idempotencyKey saat membuat order dari backend Anda.
- Order aktif bisa dipantau melalui endpoint detail order.
Contoh CURL
curl -X POST "https://webnokosai.vercel.app/api/v1/order" \
-H "Authorization: Bearer nx_live_xxx" \
-H "Content-Type: application/json" \
-d '{"service":"whatsapp","country":"id","provider":"any","idempotencyKey":"order-1001"}'Contoh JavaScript
const res = await fetch('https://webnokosai.vercel.app/api/v1/order', {
method: 'POST',
headers: {
Authorization: 'Bearer nx_live_xxx',
'Content-Type': 'application/json'
},
body: JSON.stringify({ service: 'whatsapp', country: 'id', provider: 'any', idempotencyKey: 'order-1001' })
});
const order = await res.json();Contoh PHP
$payload = json_encode(['service' => 'whatsapp', 'country' => 'id', 'provider' => 'any', 'idempotencyKey' => 'order-1001']);
$ch = curl_init('https://webnokosai.vercel.app/api/v1/order');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $payload,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer nx_live_xxx', 'Content-Type: application/json']
]);
$response = curl_exec($ch);Contoh Python
import requests
res = requests.post(
'https://webnokosai.vercel.app/api/v1/order',
headers={'Authorization': 'Bearer nx_live_xxx'},
json={'service': 'whatsapp', 'country': 'id', 'provider': 'any', 'idempotencyKey': 'order-1001'}
)
print(res.json())/api/v1/order/{id}Get order detail
Mengambil detail order, status terbaru, nomor virtual, countdown, dan kode OTP jika sudah diterima.
Authentication
Required. Bearer API key production atau sandbox.
Success Response
{
"success": true,
"data": {
"orderId": "ord_01HX...",
"status": "received",
"phoneNumber": "+62812xxxxxxx",
"otp": "123456",
"remainingSeconds": 420
},
"requestId": "req_01HX..."
}Error Response
401API key tidak valid.
403Order bukan milik akun ini.
404Order tidak ditemukan.
Catatan Implementasi
- Status yang umum: waiting, received, success, expired, cancelled.
- Polling 3–5 detik sudah cukup untuk sebagian besar integrasi.
Contoh CURL
curl -X GET "https://webnokosai.vercel.app/api/v1/order/ord_01HX" \
-H "Authorization: Bearer nx_live_xxx"Contoh JavaScript
const res = await fetch('https://webnokosai.vercel.app/api/v1/order/ord_01HX', {
headers: { Authorization: 'Bearer nx_live_xxx' }
});
const order = await res.json();Contoh PHP
$ch = curl_init('https://webnokosai.vercel.app/api/v1/order/ord_01HX');
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ['Authorization: Bearer nx_live_xxx']]);
$response = curl_exec($ch);Contoh Python
import requests
res = requests.get(
'https://webnokosai.vercel.app/api/v1/order/ord_01HX',
headers={'Authorization': 'Bearer nx_live_xxx'}
)
print(res.json())/api/v1/order/{id}/cancelCancel order
Membatalkan order aktif. Jika order memenuhi syarat refund, saldo akan dikembalikan melalui wallet transaction.
Authentication
Required. Bearer API key production atau sandbox.
Request body
reasonstringOpsional. Alasan cancel untuk audit log.
Success Response
{
"success": true,
"data": {
"orderId": "ord_01HX...",
"status": "cancelled",
"refunded": true,
"refundAmount": 6500
},
"requestId": "req_01HX..."
}Error Response
400Order tidak bisa dibatalkan pada status saat ini.
403Order bukan milik akun ini.
404Order tidak ditemukan.
Catatan Implementasi
- Cancel hanya berlaku untuk order yang masih aktif.
- Refund diproses sekali dan dilindungi idempotency.
Contoh CURL
curl -X POST "https://webnokosai.vercel.app/api/v1/order/ord_01HX/cancel" \
-H "Authorization: Bearer nx_live_xxx" \
-H "Content-Type: application/json" \
-d '{"reason":"user_requested"}'Contoh JavaScript
const res = await fetch('https://webnokosai.vercel.app/api/v1/order/ord_01HX/cancel', {
method: 'POST',
headers: {
Authorization: 'Bearer nx_live_xxx',
'Content-Type': 'application/json'
},
body: JSON.stringify({ reason: 'user_requested' })
});
const result = await res.json();Contoh PHP
$ch = curl_init('https://webnokosai.vercel.app/api/v1/order/ord_01HX/cancel');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode(['reason' => 'user_requested']),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer nx_live_xxx', 'Content-Type: application/json']
]);
$response = curl_exec($ch);Contoh Python
import requests
res = requests.post(
'https://webnokosai.vercel.app/api/v1/order/ord_01HX/cancel',
headers={'Authorization': 'Bearer nx_live_xxx'},
json={'reason': 'user_requested'}
)
print(res.json())