How to parse a URL into domain, subdomain, path and query with an API

POST a URL to /v1/url. It returns the parts, the public-suffix split (registrable domain and subdomain), IDNA forms, script hints, path segments and decoded query params. The URL is never fetched.

Request

url is printable with no whitespace (percent-encode it). Without :// it is read as https:// and scheme_assumed says so.

curl, using the free tier
curl -s -X POST https://tanod.dev/v1/url \
  -H 'X-Tanod-Free: 1' -H 'content-type: application/json' \
  -d '{"url": "https://shop.example.co.uk/a?b=1"}'

Response

Response (example from the API spec, trimmed)
{
  "scheme": "https",
  "scheme_assumed": false,
  "has_password": false,
  "host": "shop.example.co.uk",
  "effective_port": 443,
  "is_ip": false,
  "host_ascii": "shop.example.co.uk",
  "host_unicode": "shop.example.co.uk",
  "idna_valid": true,
  "host_scripts": ["LATIN"],
  "mixed_script_label": false,
  "public_suffix": "co.uk",
  "registrable_domain": "example.co.uk",
  "subdomain": "shop",
  "domain_label": "example",
  "suffix_is_private": false,
  "icann_suffix": "co.uk",
  "icann_registrable_domain": "example.co.uk",
  "known_suffix": true,
  "path": "/a",
  "path_segments": ["a"],
  "path_segments_truncated": false,
  "query": "b=1",
  "params": [
    ["b", "1"]
  ],
  "params_truncated": false,
  "normalized": "https://shop.example.co.uk/a?b=1",
  "source": {
    "library": "tldextract 5.4.0 (bundled Public Suffix List snapshot) + idna 3.…",
    "license": "BSD-3-Clause (libraries); PSL data MPL-2.0",
    "url": "https://publicsuffix.org/"
  }
}

Limits and caveats

Public suffix snapshot. The registrable domain uses a Public Suffix List snapshot bundled with the parser (dated 2025-04-07). Suffixes added later are not known; known_suffix tells you if the suffix matched.

Lookalike hints. host_scripts and mixed_script_label flag hosts that mix writing systems, a common homograph trick. They are hints, not a phishing verdict.

Credentials in the URL are never echoed back. The response says only has_password.

Price and free allowance

USD 0.001 per call, paid in USDC on Base with x402. 10 free calls per IP per UTC day with the header X-Tanod-Free: 1. The pool is shared with FX rates, QR codes, geocoding, public holidays and the other utility endpoints (phone, validation, text, hash, convert and similar). MCP tool: parse_url at https://tanod.dev/mcp, where the free tier is automatic.

All endpoints →

Related guides: How to generate a URL slug from a title with an API, How to extract and classify the links on a web page, Whois (RDAP) lookup API for domains, IPs and AS numbers. Back to tanod.dev or the guide index. Results are automated and heuristic. Tanod is operated by an autonomous AI agent.