📔
DataLabs
  • Introduction
    • 📄DataLabs Documentation
  • Captcha API
    • 📃Captcha Overview
    • 💲Get Balance [/getBalance]
    • 🤖Create Task [/createTask]
    • 🤝Get Task Result [/getTaskResult]
    • 📋Report Bad Solution [/reportIncorrectRecaptcha]
    • 🏠Using Proxies
    • 🍪Using Cookies
    • 🧩Parameters
    • 💲Captcha Pricing
  • Captcha Tasks
    • 🟢ReCaptcha V2 Tasks
      • 🤖ReCaptcha V2
      • 🤖Recaptcha V2 Proxyless
      • 🤖ReCaptcha V2 Enterprise
      • 🤖ReCaptcha V2 Enterprise Proxyless
    • 🟢ReCaptcha V3 Tasks
      • 🤖ReCaptcha V3
      • 🤖ReCaptcha V3 Proxyless
      • 🤖ReCaptcha V3 Enterprise
      • 🤖ReCaptcha V3 Enterprise Proxyless
    • 🟢GeeTest Tasks
      • 🤖GeeTest V3 Proxyless
      • 🤖GeeTest V4 Proxyless
    • 🟢Cloudflare Tasks
      • 🤖Cloudflare Turnstile & Challenge
    • 🟢AWS WAF Tasks
      • 🤖AWS WAF Captcha
      • 🤖AWS WAF Captcha Proxyless
    • 🟠Datadome Tasks
      • 🤖Datadome
    • 🔴Fun Captcha Tasks
      • 🤖Fun Captcha
      • 🤖Fun Captcha Proxyless
    • 🔴Incapsula/Imperva Tasks
      • 🤖Imperva / Incapsula
      • 🤖Imperva / Incapsula Proxyless
  • Tools API
    • 📃Tools Overview
    • 💲Tools Pricing
    • 📱Communication Tools
      • 📞Phone Lookup API
      • 📧Email Validator API
      • 🗑️Disposable Mail Check API
    • 🛜Network Tools
      • 🔎Subdomain Finder API
      • 🔥Firewall Detector API
      • 🖇️IP to Domains API
      • 🕵️Whois Checker API
      • 📍GeoIP Location API
      • ❌Website Status API
      • 📋Site Reputation API
      • 🖥️Get Website Headers
      • 📝Link Backup API
Powered by GitBook
On this page
  1. Tools API
  2. Communication Tools

Phone Lookup API

Get carrier and location info for any phone number.

The API host for all tools is tools.datalabs.net.


Phone Lookup API

POST https://tools.datalabs.net/phoneLookup
Host: tools.datalabs.net
Content-Type: application/json

{
  "key": "DATALABS_API_KEY", // Required - DataLabs API Key
  "number": "+15553058172" // Required - Phone number with "+" and country code.
}
import requests

api_key = "DATALABS_API_KEY"
tool = "phoneLookup"
number = "+1XXXXXXXXXX"

url = f"https://tools.datalabs.net/{tool}?key={api_key}&number={number}"
headers = {
    'Host': 'tools.datalabs.net'
}

response = requests.get(url, headers=headers)

try:
    response_data = response.json()
except ValueError:
    response_data = response.text

print(response_data)
const axios = require('axios');

const api_key = "DATALABS_API_KEY";
const tool = "phoneLookup";
const number = "+1XXXXXXXXXX";

const url = `https://tools.datalabs.net/${tool}?key=${api_key}&number=${number}`;
const headers = {
    'Host': 'tools.datalabs.net'
};

axios.get(url, { headers })
    .then(response => {
        console.log(response.data);
    })
    .catch(error => {
        if (error.response) {
            console.log(error.response.data);
        } else {
            console.log(error.message);
        }
    });
package main

import (
    "encoding/json"
    "fmt"
    "io/ioutil"
    "net/http"
)

func main() {
    apiKey := "DATALABS_API_KEY"
    tool := "phoneLookup"
    number := "+1XXXXXXXXXX"

    url := fmt.Sprintf("https://tools.datalabs.net/%s?key=%s&number=%s", tool, apiKey, number)
    req, err := http.NewRequest("GET", url, nil)
    if err != nil {
        fmt.Println("Error:", err)
        return
    }
    req.Header.Set("Host", "tools.datalabs.net")

    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        fmt.Println("Error making HTTP request:", err)
        return
    }
    defer resp.Body.Close()

    if resp.StatusCode != http.StatusOK {
        fmt.Printf("Non-OK HTTP status: %s\n", resp.Status)
        return
    }

    body, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        fmt.Println("Error reading response body:", err)
        return
    }

    var responseData map[string]interface{}
    if err := json.Unmarshal(body, &responseData); err != nil {
        fmt.Println("Error unmarshaling JSON:", err)
        fmt.Println(string(body))
    } else {
        fmt.Println(responseData)
    }
}
using System;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json; // Ensure this directive is present for JsonReaderException

class Program
{
    static void Main(string[] args)
    {
        // Call the async method
        MainAsync(args).GetAwaiter().GetResult();
    }

    static async Task MainAsync(string[] args)
    {
        string apiKey = "DATALABS_API_KEY";
        string tool = "phoneLookup";
        string number = "+1XXXXXXXXXX";
        
        string url = string.Format("https://tools.datalabs.net/{0}?key={1}&number={2}", tool, apiKey, number);
        
        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Host", "tools.datalabs.net");
            
            try
            {
                HttpResponseMessage response = await client.GetAsync(url);
                response.EnsureSuccessStatusCode();
                
                string responseBody = await response.Content.ReadAsStringAsync();
                
                try
                {
                    var responseData = JObject.Parse(responseBody);
                    Console.WriteLine("Response data:");
                    Console.WriteLine(responseData);
                }
                catch (JsonReaderException jsonEx)
                {
                    Console.WriteLine("JSON Parsing error: " + jsonEx.Message);
                    Console.WriteLine("Response body:");
                    Console.WriteLine(responseBody);
                }
            }
            catch (HttpRequestException e)
            {
                Console.WriteLine("Request error: " + e.Message);
            }
        }
    }
}
Example Response
{
    "success": true,
    "details": {
        "valid": true,
        "number": "1XXXXXXXXXX",
        "international_format": "+1XXXXXXXXXX",
        "country_code": "US",
        "country_name": "USA",
        "region": "Milam",
        "city": "Milano, TX",
        "carrier": "Level 3 Communications, Landline",
        "provider": "UNITED STATES"
    }
}
PreviousCommunication ToolsNextEmail Validator API

Last updated 11 months ago

📱
📞