Dokumentasi API

Kunci API
Metode yang tersedia
Metode URL Deskripsi Pengaturan
GET/POST /api/v1/phone/validate Validasi nomor phone, country, api_key
Parameter:
Parameter Deskripsi Contoh Wajib
api_key Kunci API your_key Ya
phone Nomor telepon +393201234567 Ya
country Kode negara IT, ["IT","US","DE"] Tidak
Bekerja dengan beberapa negara

Parameter country mendukung beberapa format:

  • Satu negara: IT
  • Beberapa negara dipisahkan dengan koma: IT,US,DE
  • Beberapa negara dipisahkan dengan titik koma: IT;US;DE
  • Beberapa negara dipisahkan dengan spasi: IT US DE
  • Array negara (POST): ["IT", "US", "DE"]

API mencoba mengurai nomor dengan setiap negara secara berurutan sampai menemukan hasil yang valid. Ini sangat berguna untuk nomor dalam format nasional.

Kode respons
Kode Deskripsi Contoh
200 Permintaan berhasil
{
  "success": true,
  "data": {
    "is_valid": true,
    "type_id": 1,
    "type_name": "Mobile",
    "is_mobile": true,
    "is_fixed_line": false,
    "phone_code": "+39",
    "country_code": "IT",
    "location": null,
    "international": "+39 320 123 4567",
    "national": "320 123 4567",
    "e164": "+393201234567",
    "rfc3966": "tel:+39-320-123-4567"
  },
  "error": null,
  "request_id": "a430273e63f07ef5805f04e5f8a94d16f0351fd7"
}
400 Permintaan tidak valid (kesalahan dalam parameter)
{
  "success": false,
  "data": null,
  "error": "Invalid phone number",
  "request_id": "b1e2c3d4e5f6a7b8c9d0e1f2a3b4c5d6"
}
401 Tidak diotorisasi (kunci API tidak valid atau hilang)
{
  "success": false,
  "data": null,
  "error": "Invalid API key",
  "request_id": "c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7"
}
403 Akses ditolak (tidak ada izin atau diblokir)
{
  "success": false,
  "data": null,
  "error": "Access denied",
  "request_id": "d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8"
}
404 Metode atau sumber daya tidak ditemukan
{
  "success": false,
  "data": null,
  "error": "Method or resource not found",
  "request_id": "e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9"
}
429 Batas permintaan terlampaui
{
  "success": false,
  "data": null,
  "error": "Request limit exceeded",
  "request_id": "f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0"
}
500 Kesalahan internal server
{
  "success": false,
  "data": null,
  "error": "Internal server error",
  "request_id": "a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1"
}
Kunci API pengujian: test
Jika Anda menggunakan kunci ini dalam permintaan, API selalu mengembalikan respons demonstrasi (mock).
Saldo tidak dikurangi, pemeriksaan nyata tidak dilakukan.
Contoh:
curl "https://numlook.ru/api/v1/phone/validate?phone=+393201234567&api_key=test"
Contoh penggunaan
Perintah cURL
Validasi nomor:
cURL
curl "https://numlook.ru/api/v1/phone/validate?phone=+393201234567&api_key=your_key"
Dengan beberapa negara:
cURL
curl "https://numlook.ru/api/v1/phone/validate?phone=3201234567&country=IT,US,DE&api_key=your_key"
Permintaan POST dengan daftar negara:
cURL
curl -X POST "https://numlook.ru/api/v1/phone/validate" \
  -H "Content-Type: application/json" \
  -d '{
    "phone": "3201234567",
    "country": ["IT", "US", "DE"],
    "api_key": "your_key"
  }'
JavaScript (fetch)
Validasi nomor:
JavaScript
// Number validation
fetch('https://numlook.ru/api/v1/phone/validate?phone=+393201234567&api_key=your_key')
.then(response => response.json())
.then(data => console.log(data));
Dengan beberapa negara:
JavaScript
// With multiple countries
fetch('https://numlook.ru/api/v1/phone/validate?phone=3201234567&country=IT,US,DE&api_key=your_key')
.then(response => response.json())
.then(data => console.log(data));
Permintaan POST dengan daftar negara:
JavaScript
// POST request with array of countries
fetch('https://numlook.ru/api/v1/phone/validate', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    phone: '3201234567',
    country: ['IT', 'US', 'DE'],
    api_key: 'your_key'
  })
})
.then(response => response.json())
.then(data => console.log(data));
PHP
Validasi satu nomor:
PHP
// Single number validation
$apiKey = 'your_key';
$phone = '+393201234567';

$response = file_get_contents(
    "https://numlook.ru/api/v1/phone/validate?phone=" . urlencode($phone) . "&api_key=" . $apiKey
);

$data = json_decode($response, true);
var_dump($data);
Dengan beberapa negara:
PHP
// With multiple countries
$apiKey = 'your_key';
$phone = '3201234567';
$countries = 'IT,US,DE';

$response = file_get_contents(
    "https://numlook.ru/api/v1/phone/validate?phone=" . urlencode($phone) . "&country=" . urlencode($countries) . "&api_key=" . $apiKey
);

$data = json_decode($response, true);
var_dump($data);
Permintaan POST dengan daftar negara:
PHP
// POST request with array of countries
$apiKey = 'your_key';
$postData = json_encode([
    'phone' => '3201234567',
    'country' => ['IT', 'US', 'DE'],
    'api_key' => $apiKey
]);

$context = stream_context_create([
    'http' => [
        'method' => 'POST',
        'header' => 'Content-Type: application/json',
        'content' => $postData
    ]
]);

$response = file_get_contents('https://numlook.ru/api/v1/phone/validate', false, $context);
$data = json_decode($response, true);
var_dump($data);