Skip to content
PithLab

↑↓ to move · Enter to open · Esc to close

URL Parser API

Split a URL into its parts with the WHATWG URL parser: protocol, credentials, host, port (explicit, default and effective), path segments, decoded query parameters and fragment. Nothing is fetched.

POST /api/v1/tools/url-parserMCP url_parserDeveloper Tools

Split a URL into protocol, host, port, path, query parameters and hash, then edit the parameters in a table and rebuild the URL live. Nothing is fetched.

Input

Send these as a JSON object. Unknown fields are rejected.

url
An absolute URL including its scheme, e.g. https://example.com:8443/a/b?q=1#top. (string, up to 10000 characters, required)
curl https://pithlab.com/api/v1/tools/url-parser \n  -H "Authorization: Bearer $PITHLAB_KEY" \n  -H "Content-Type: application/json" \n  -d '{"url":"https://shop.example.com:8443/products/red%20shoes?size=42&utm_source=newsletter#reviews"}'
Example response
{
  "ok": true,
  "result": {
    "href": "https://shop.example.com:8443/products/red%20shoes?size=42&utm_source=newsletter#reviews",
    "origin": "https://shop.example.com:8443",
    "protocol": "https:",
    "username": "",
    "password": "",
    "host": "shop.example.com:8443",
    "hostname": "shop.example.com",
    "port": "8443",
    "defaultPort": "443",
    "effectivePort": "8443",
    "pathname": "/products/red%20shoes",
    "segments": [
      "products",
      "red shoes"
    ],
    "search": "?size=42&utm_source=newsletter",
    "params": [
      {
        "key": "size",
        "value": "42"
      },
      {
        "key": "utm_source",
        "value": "newsletter"
      }
    ],
    "hash": "#reviews"
  }
}