Docs

# Check Number

This endpoint allows you to verify whether a given phone number is eligible for a prepaid top-up. If the number is rechargeable, the response includes the associated mobile network operator.

It is mandatory to call this endpoint before attempting a top-up. This validation helps minimize errors and failed requests.

# Send a Request

To check a phone number, send a POST request to the /v1/check-number endpoint.

Required parameters:

Parameter Required? Description
phone_number yes The mobile phone number to be recharged. Use the format 407PPXXXXXX.

# Code Samples

# Staging

curl -X POST "https://api-staging.reincarcareprepay.ro/v1/check-number" \
     -H "X-Authorization: [STAGING_API_KEY]" \
     -H "Content-Type: application/json" \
     -d '{
           "phone_number": "0712345678",
         }'
try {
    const res = await fetch("https://api-staging.reincarcareprepay.ro/v1/check-number", {
        method: "POST",
        headers: {
            "X-Authorization": "[STAGING_API_KEY]",
            "Content-Type": "application/json"
        },
        body: JSON.stringify({
            phone_number: "40756859285"
        })
    })
    const json = await res.json()
    console.log(json)
} catch(err) {
    console.log(err)
}
<?php

$url = "https://api-staging.reincarcareprepay.ro/v1/check-number";
$apiKey = "[STAGING_API_KEY]";

$data = [
    "phone_number" => "40756859285",
];

$ch = curl_init($url);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "X-Authorization: $apiKey",
    "Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));

$response = curl_exec($ch);
curl_close($ch);

echo $response;

# Production

curl -X POST "https://api.reincarcareprepay.ro/v1/check-number" \
     -H "X-Authorization: [PROD_API_KEY]" \
     -H "Content-Type: application/json" \
     -d '{
           "phone_number": "0712345678",
         }'
try {
    const res = await fetch("https://api.reincarcareprepay.ro/v1/check-number", {
        method: "POST",
        headers: {
            "X-Authorization": "[PROD_API_KEY]",
            "Content-Type": "application/json"
        },
        body: JSON.stringify({
            phone_number: "40756859285"
        })
    })
    const json = await res.json()
    console.log(json)
} catch(err) {
    console.log(err)
}
<?php

$url = "https://api.reincarcareprepay.ro/v1/check-number";
$apiKey = "[PROD_API_KEY]";

$data = [
    "phone_number" => "40756859285",
];

$ch = curl_init($url);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "X-Authorization: $apiKey",
    "Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));

$response = curl_exec($ch);
curl_close($ch);

echo $response;

# Response

On success, the endpoint returns:

{
  "isValid": true,
  "operator": "orange|vodafone|telekom",
  "sanitizedNumber": "40756859285"
}

On error, the endpoint returns:

{
  "isValid": false,
  "message": "error_message"
}