Parse a URL into components
Exacturls_parseDeterministic and authoritative — the canonical answer for this input.
Split a URL into its components: scheme, host, port, path, query (as a dict), fragment, and any username/password. A missing scheme is reported as confidence 0.0 (the components are still returned); a malformed authority (host or userinfo with illegal characters) is rejected as is_valid:false; raw internationalized domains are accepted. Processing multiple inputs? Use `urls_parse_batch` to do up to 1000 in one call.
Parameters
valuestringrequiredThe URL to split into components.
Call it
curl -X POST https://api.snipget.ai/v1/urls/parse \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{"value":"https://user:[email protected]:8080/search?q=shoes&page=2#results"}'The Batch tab sends up to 1000 inputs in one call via /v1/urls/parse/batch.
Example response
{
"input": "https://user:[email protected]:8080/search?q=shoes&page=2#results",
"is_valid": true,
"scheme": "https",
"host": "example.com",
"port": 8080,
"path": "/search",
"query": {
"q": [
"shoes"
],
"page": [
"2"
]
},
"query_string": "q=shoes&page=2",
"fragment": "results",
"username": "user",
"password": "pass"
}FAQ
What do I get back?
Every part of the URL split out for you: scheme, host, port, path, the query as both a tidy key-to-values map and the raw string, the fragment, and any username or password in the link. It is a reliable way to grab just the host or just one query value without string-slicing by hand.
Why does each query value come back as a list?
Because a URL can repeat the same key (like ?tag=a&tag=b), so values are grouped under each key as a list to avoid silently dropping duplicates. A single value still appears, just inside a one-item list.
What if my link has no https:// in front?
A link with no scheme is reported with is_valid false, confidence 0, and a why_invalid hint to prepend something like https://. The parts it could read are still returned, so nothing is hidden.
Does it fetch the page or change anything?
No. It only reads and splits the text of the URL. It does not visit the link, and to edit a query parameter you would use the query-edit tool instead.
Is the parse exact?
Yes. It follows the URL standard and is deterministic, so the same input always splits the same way, with no approximation.