Nokos.co.id
5-Minute Integration

API Quick Start Guide
Integrasi Nokos dalam 5 Menit

Tutorial step-by-step integrasi REST API Nokos.co.id ke aplikasi kamu — kompatibel SMS-Activate protocol, support PHP, Node.js, Python.

Last updated: · ⏱️ Reading time: 5 min

PHP Node.js Python cURL SMS-Activate Compatible

Apa yang akan kamu pelajari

  • Cara generate API Key dan setup authentication header
  • Order nomor virtual untuk verifikasi WhatsApp/Telegram/Shopee/dll
  • Polling status sampai SMS OTP masuk
  • Pilih server (Plus / Express) untuk harga & stok terbaik
  • Implementasi di PHP, Node.js, Python dengan code production-ready
  • Best practices: error handling, rate limits, retry logic

Kenapa pakai Nokos API?

Harga termurah Indonesia

Mulai Rp 150 per OTP. Markup transparan, refund otomatis kalau gagal.

478+ aplikasi · 76 negara

WhatsApp, Telegram, Tinder, Gojek, Shopee, Instagram, Facebook, dll.

SMS-Activate Compatible

Drop-in replacement. Migrate dari SMS-Activate tinggal ganti base URL.

Dual-Server System

Server Plus (hemat) + Server Express (cepat). Switch via parameter server.

1

Daftar & Generate API Key

Daftar gratis di nokos.co.id/register, login, lalu buka Profile → API Key. Klik tombol Generate untuk dapat API key 64 karakter.

⚠️ Penting

  • • API key bersifat rahasia, jangan commit ke Git public atau share publicly.
  • • Simpan di .env file dan load via environment variable.
  • • Top up minimal Rp 10.000 sebelum order untuk testing.
2

Setup Authentication

Semua request Nokos API butuh header X-API-Key atau Authorization: Bearer. Ini contoh test endpoint paling simple — cek saldo akun:

curl "https://nokos.co.id/api/?action=getBalance" \
  -H "X-API-Key: YOUR_API_KEY"
<?php
$apiKey = getenv('NOKOS_API_KEY');
$ch = curl_init('https://nokos.co.id/api/?action=getBalance');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => ['X-API-Key: ' . $apiKey],
]);
$response = json_decode(curl_exec($ch), true);
echo "Saldo: Rp " . number_format($response['data']['balance'], 0, ',', '.');
const apiKey = process.env.NOKOS_API_KEY;
const res = await fetch('https://nokos.co.id/api/?action=getBalance', {
    headers: { 'X-API-Key': apiKey }
});
const { data } = await res.json();
console.log(`Saldo: Rp ${data.balance.toLocaleString('id-ID')}`);
import os
import requests

API_KEY = os.environ['NOKOS_API_KEY']
HEADERS = {'X-API-Key': API_KEY}

r = requests.get('https://nokos.co.id/api/', params={'action': 'getBalance'}, headers=HEADERS)
data = r.json()['data']
print(f"Saldo: Rp {data['balance']:,}")
3

Order Nomor Virtual

Beli nomor untuk verifikasi WhatsApp Indonesia. Parameter: service=wa (kode aplikasi), country=6 (Indonesia), server=s2 (Server Plus, paling hemat).

curl -X POST "https://nokos.co.id/api/?action=getNumber" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d "service=wa&country=6&server=s2"
$ch = curl_init('https://nokos.co.id/api/?action=getNumber');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_POSTFIELDS     => http_build_query([
        'service' => 'wa',
        'country' => 6,
        'server'  => 's2',
    ]),
    CURLOPT_HTTPHEADER     => ['X-API-Key: ' . $apiKey],
]);
$order = json_decode(curl_exec($ch), true);
echo "Phone: " . $order['data']['phone'] . "\n";
echo "Activation ID: " . $order['data']['activation_id'];
const orderRes = await fetch('https://nokos.co.id/api/?action=getNumber', {
    method: 'POST',
    headers: {
        'X-API-Key': apiKey,
        'Content-Type': 'application/x-www-form-urlencoded'
    },
    body: 'service=wa&country=6&server=s2'
});
const order = await orderRes.json();
console.log(`Phone: ${order.data.phone}`);
console.log(`Activation ID: ${order.data.activation_id}`);
r = requests.post('https://nokos.co.id/api/',
    params={'action': 'getNumber'},
    data={'service': 'wa', 'country': 6, 'server': 's2'},
    headers=HEADERS
).json()

activation_id = r['data']['activation_id']
phone = r['data']['phone']
print(f"Phone: {phone}, ID: {activation_id}")

Catatan Server Selection

Nokos punya 2 jaringan provider: Server Plus (s2) dengan harga termurah, dan Server Express (s1) dengan respons cepat. Tarif & stok beda di tiap server. Default = s2.

4

Polling Status & Ambil OTP

Setelah order, polling endpoint getStatus tiap 3-5 detik sampai SMS masuk. Status yang mungkin: waiting, received, cancelled, expired.

async function pollOTP(activationId, timeoutMs = 1200000) {
    const start = Date.now();
    while (Date.now() - start < timeoutMs) {
        const res = await fetch(
            `https://nokos.co.id/api/?action=getStatus&id=${activationId}`,
            { headers: { 'X-API-Key': apiKey } }
        );
        const { data } = await res.json();

        if (data.status === 'received') {
            console.log(`✅ OTP received: ${data.code}`);
            return data.code;
        }
        if (['cancelled', 'expired'].includes(data.status)) {
            throw new Error(`Activation ${data.status}`);
        }

        await new Promise(r => setTimeout(r, 3000)); // poll every 3s
    }
    throw new Error('Timeout 20 minutes');
}

// Usage:
const otpCode = await pollOTP(order.data.activation_id);
import time

def poll_otp(activation_id, timeout=1200):
    start = time.time()
    while time.time() - start < timeout:
        r = requests.get('https://nokos.co.id/api/',
            params={'action': 'getStatus', 'id': activation_id},
            headers=HEADERS
        ).json()
        status = r['data']['status']

        if status == 'received':
            print(f"✅ OTP received: {r['data']['code']}")
            return r['data']['code']
        if status in ('cancelled', 'expired'):
            raise Exception(f"Activation {status}")

        time.sleep(3)  # poll every 3s

    raise TimeoutError("Polling timeout 20 minutes")

# Usage:
otp_code = poll_otp(activation_id)
function pollOTP($activationId, $apiKey, $timeoutSec = 1200) {
    $start = time();
    while (time() - $start < $timeoutSec) {
        $ch = curl_init("https://nokos.co.id/api/?action=getStatus&id={$activationId}");
        curl_setopt_array($ch, [
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_HTTPHEADER     => ['X-API-Key: ' . $apiKey],
        ]);
        $r = json_decode(curl_exec($ch), true);
        $status = $r['data']['status'];

        if ($status === 'received') {
            echo "✅ OTP received: " . $r['data']['code'];
            return $r['data']['code'];
        }
        if (in_array($status, ['cancelled', 'expired'])) {
            throw new Exception("Activation {$status}");
        }

        sleep(3); // poll every 3s
    }
    throw new Exception('Timeout 20 minutes');
}

// Usage:
$otpCode = pollOTP($order['data']['activation_id'], $apiKey);

Service Codes Populer

Daftar kode service paling banyak dipakai. Lihat full API docs untuk 478+ service.

Service Code Harga (mulai)
WhatsAppwaRp 250
TelegramtgRp 150
TinderoiRp 1.500
GojekniRp 500
ShopeekaRp 200
InstagramigRp 400
FacebookfbRp 350
TikToklfRp 100
Google/GmailgoRp 600

FAQ Developer

Apakah API ini benar-benar SMS-Activate compatible?

Ya, Nokos API mengikuti spec SMS-Activate (handler_api.php convention). Library/SDK existing yang lo pakai untuk SMS-Activate bisa di-migrate hanya dengan ubah BASE_URL ke https://nokos.co.id/api/. Endpoint, parameter, response format identik.

Berapa rate limit API?

60 requests/menit per IP untuk endpoint baca (getBalance, getStatus, getPrices). 3 detik cooldown antar getNumber per user untuk anti-spam. Lihat full rate limits.

Bagaimana jika OTP tidak masuk?

Jika status masih waiting setelah 20 menit, sistem otomatis expire dan saldo di-refund 100%. Lo juga bisa cancel manual via action=setStatus&status=8 kapan saja sebelum SMS masuk.

Server mana yang lebih bagus, Plus atau Express?

Server Plus (s2) default — harga lebih hemat, stok lengkap untuk WhatsApp/Telegram/Shopee. Server Express (s1) alternatif kalau butuh respons lebih cepat atau Server Plus stok habis. Untuk produksi: implementasi fallback (coba s2 dulu, kalau gagal coba s1).

Apakah ada SDK official?

SDK PHP/Node.js/Python sedang dalam pengembangan. Sementara, lo bisa pakai code examples di GitHub sebagai starting point. Library SMS-Activate community juga compatible (tinggal ganti BASE_URL).

Bagaimana cara dapatkan webhook callback?

Setup webhook URL di dashboard → Profile → Webhooks. Nokos akan POST ke URL kamu setiap event SMS received, dengan payload JSON berisi activation_id, phone_number, sms_code, dst. Cocok untuk integrasi serverless (Cloudflare Workers, AWS Lambda).

Siap Build dengan Nokos API?

Daftar gratis sekarang, generate API key, dan mulai integrasi dalam 5 menit. Top up minimal Rp 10.000 untuk testing — tidak ada minimum komitmen, no monthly fee.

Baca Juga