
URL Inspector API
Development
Analyze any URL and break it down into components. Extract protocol, hostname, port, pathname, query parameters, and fragments instantly.
Authentication
All API requests require a valid API key passed in the Authorization header as a Bearer token.
Rate Limit
120 requests per minute
Endpoints
2 endpoints available
Overview
Breaks a URL into its parts with the standard URL parser. It only parses the text you send: the URL is never fetched, so the page behind it is not loaded and no DNS lookup is made.
Fields
- href - the normalized full URL
- protocol - the scheme with a trailing colon, such as
https: - origin - scheme, host and port. It is the string
nullfor schemes without an origin, such asmailto: - host - hostname plus port when the port is not the default
- hostname, port, pathname
- search - the query string with its leading
?, or empty - hash - the fragment with its leading
#, or empty - searchParams - the query as an ordered list of
{ name, value }pairs, decoded. Repeated names are kept.
Notes
- The URL must be absolute, with a scheme (for example
https://). Up to 8,000 characters. - The parser normalizes what it reads: hostnames are lowercased, default ports are dropped and international domain names become punycode.
- Any scheme that parses is accepted, not only http and https.
Endpoints
GET
https://opentools.ca/api/v1/tools/url-inspectorParse a URL into its components
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| url | string | Required | The absolute URL to parse, up to 8,000 characters. URL-encode it in the query string. |
Response Example
{
"success": true,
"href": "https://example.com:8080/path/to/page?foo=bar&baz=qux#section",
"protocol": "https:",
"origin": "https://example.com:8080",
"host": "example.com:8080",
"hostname": "example.com",
"port": "8080",
"pathname": "/path/to/page",
"search": "?foo=bar&baz=qux",
"hash": "#section",
"searchParams": [
{
"name": "foo",
"value": "bar"
},
{
"name": "baz",
"value": "qux"
}
]
}Error Codes
400
Bad Request - Missing url, too long, or not a valid absolute URL401
Unauthorized - Invalid or missing API key403
Forbidden - API key is inactive or expired, or the request IP is not allowed for this key429
Too Many Requests - Rate limit exceeded500
Internal Server ErrorPOST
https://opentools.ca/api/v1/tools/url-inspectorParse a URL into its components (JSON body)
Request Body
Content-Type: application/json
| Parameter | Type | Required | Description |
|---|---|---|---|
| url | string | Required | The absolute URL to parse, up to 8,000 characters. |
Response Example
{
"success": true,
"href": "https://example.com/",
"protocol": "https:",
"origin": "https://example.com",
"host": "example.com",
"hostname": "example.com",
"port": "",
"pathname": "/",
"search": "",
"hash": "",
"searchParams": []
}Error Codes
400
Bad Request - Missing url, too long, or not a valid absolute URL401
Unauthorized - Invalid or missing API key403
Forbidden - API key is inactive or expired, or the request IP is not allowed for this key429
Too Many Requests - Rate limit exceeded500
Internal Server ErrorCode Examples
curl -X POST https://opentools.ca/api/v1/tools/url-inspector \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com:8080/path/to/page?foo=bar&baz=qux#section"}'
curl -G https://opentools.ca/api/v1/tools/url-inspector \
-H "Authorization: Bearer YOUR_API_KEY" \
--data-urlencode "url=https://example.com/a?b=c"Rather use it in your browser? Open the URL Inspector