Skip to main content
GET
/
v3
/
internet
/
check-number
Validate Phone Number
curl --request GET \
  --url https://api.oneclickdz.com/v3/internet/check-number \
  --header 'X-Access-Token: <api-key>'

Overview

Validates phone numbers for ADSL or 4G services before submission. Helps prevent errors and reduces refund issues.
Always validate phone numbers before submitting top-up requests to minimize failures.

Query Parameters

type
string
required
Service type: ADSL or 4G
number
string
required
Phone number to validate - ADSL: 0[0-9]{8} (e.g., 036362608) - 4G: 213[0-9]{9} (e.g., 213472731602)

Response

Valid ADSL Number

{
  "success": true,
  "data": {
    "ncli": "11022*****",
    "offre": "FTTc-b_10M'",
    "type": "ADSL"
  },
  "meta": {
    "timestamp": "2025-10-29T00:36:48.823Z"
  }
}

Valid 4G Number

{
  "success": true,
  "data": {
    "ncli": "11034*****",
    "type": "4GLTE"
  },
  "meta": {
    "timestamp": "2025-10-29T00:36:49.847Z"
  }
}

Invalid Number

{
  "success": false,
  "error": {
    "code": "ERR_PHONE",
    "message": "Invalid phone number for ADSL service",
    "details": {
      "number": "123456",
      "type": "ADSL",
      "reason": "Number does not match required format"
    }
  }
}

Examples

curl "https://api.oneclickdz.com/v3/internet/check-number?type=ADSL&number=036362608" \
  -H "X-Access-Token: YOUR_API_KEY"

Phone Number Formats

  • ADSL
  • 4G
Format: 0[0-9]{8} Valid Examples: - ✅ 036362608 - ✅ 031417237 - ✅ 021123456 Invalid Examples: - ❌ 36362608 (missing leading 0) - ❌ 0363626081 (too long) - ❌ 213636362608 (wrong format)

Integration Example

// Complete validation flow
async function prepareInternetTopup(type, number, value) {
  // Step 1: Validate number
  try {
    await validateNumber(type, number);
  } catch (error) {
    return {
      success: false,
      error: "Invalid phone number",
      details: error.message,
    };
  }

  // Step 2: Check product availability
  const products = await getProducts(type);
  const product = products.find((p) => p.value === value && p.available);

  if (!product) {
    return {
      success: false,
      error: "Product not available",
    };
  }

  // Step 3: Send top-up
  return await sendInternetTopup({ type, number, value });
}

Why Validate?

Reduce Errors

Catch invalid numbers before submission

Better UX

Show immediate feedback to users

Fewer Refunds

Minimize failed transactions and refunds

Verify Format

Ensure number matches service type

Best Practices

Validate format client-side first, then confirm with API:
function validateADSLFormat(number) {
  return /^0[0-9]{8}$/.test(number);
}

function validate4GFormat(number) {
  return /^213[0-9]{9}$/.test(number);
}
Display clear messages when validation fails: - “Please enter a valid ADSL number (e.g., 036362608)” - “4G numbers should start with 213 (e.g., 213665983439)” - “Number format: 9 digits starting with 0”
Cache successful validations for a short period:
const validationCache = new Map();

async function validateWithCache(type, number) {
  const key = `${type}:${number}`;
  
  if (validationCache.has(key)) {
    return validationCache.get(key);
  }
  
  const result = await validateNumber(type, number);
  validationCache.set(key, result);
  
  // Clear after 5 minutes
  setTimeout(() => validationCache.delete(key), 5 * 60 * 1000);
  
  return result;
}