Dokumentasi API
Code Examples
Contoh integrasi siap pakai untuk membaca katalog, membuat order, mengambil status OTP, dan membatalkan order.
JavaScript — create order and poll OTP
Example
const apiKey = process.env.NEXOTP_API_KEY;
const baseUrl = 'https://webnokosai.vercel.app';
async function createOrder() {
const res = await fetch(baseUrl + '/api/v1/order', {
method: 'POST',
headers: {
Authorization: 'Bearer ' + apiKey,
'Content-Type': 'application/json'
},
body: JSON.stringify({
service: 'whatsapp',
country: 'id',
provider: 'any',
idempotencyKey: 'order-' + Date.now()
})
});
return res.json();
}
async function getOrder(orderId) {
const res = await fetch(baseUrl + '/api/v1/order/' + orderId, {
headers: { Authorization: 'Bearer ' + apiKey }
});
return res.json();
}PHP — list services
Example
$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);
$data = json_decode($response, true);
print_r($data);Python — cancel order
Example
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())