Validate international phone numbers and detect the line type

Sending an SMS verification code to a landline fails silently and still costs you. Storing numbers in inconsistent formats breaks deduplication. Validate once, at input time, and store the E.164 form.

Make the request

Send your API key in the x-api-key header. Free accounts include 1,000 calls a month.

curl "https://apistack.online/api/utilities/phone-number-validation/v1/validate?phoneNumber=%2B442079460958" \
  -H "x-api-key: $APISTACK_API_KEY"
200 OK · response
{
  "success": true,
  "data": {
    "phoneNumber": "+442079460958",
    "validation": {
      "isValid": true,
      "possibleCountries": [
        "GB"
      ],
      "isPossible": true,
      "type": "FIXED_LINE",
      "reason": "Valid phone number"
    }
  }
}

Response abridged: some fields (timestamps, metadata) omitted.

URL-encode the plus sign

In a query string, + means a space. Send +44… as %2B44… (encodeURIComponent in JavaScript; requests does it for you if you pass params={"phoneNumber": "+442079460958"}).

Route by line type

Send SMS codes only when type is MOBILE (or FIXED_LINE_OR_MOBILE); offer a voice call for FIXED_LINE numbers. Validation checks numbering plans; it doesn't prove the number is currently in service.

Give it to your AI agent

The same API is available as an MCP tool. Add APIStack to Claude, Cursor, VS Code or any MCP client:

{
  "mcpServers": {
    "apistack": {
      "url": "https://apistack.online/api/mcp/connect",
      "headers": { "x-api-key": "YOUR_API_KEY" }
    }
  }
}

Then ask: “Is +44 20 7946 0958 a valid phone number? What type of line is it?” See MCP setup for every client.

Related guides