Skip to content
POST AI agent ready /v1/url/parse

URL Parse API - Free URL Component Extractor

Breaks a URL into its structural components: protocol, hostname, port, pathname, search params (as key-value pairs), and hash fragment. Useful for URL analysis and routing logic.

Parameters

stringrequired

The URL to parse.

Code examples

curl -X POST https://api.botoi.com/v1/url/parse \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/path?q=test&page=2#section"}'

When to use this API

URL-based routing in serverless functions

Parse incoming request URLs to extract path segments and query parameters for request routing without a full framework.

Link analysis and categorization

Extract the hostname from user-submitted URLs to categorize links by domain, detect affiliate URLs, or block specific origins.

Analytics tag extraction

Parse marketing URLs to extract UTM parameters (utm_source, utm_medium, utm_campaign) for tracking attribution.

Frequently asked questions

Are query parameters returned as an object?
Yes. The searchParams field contains a key-value object where each query parameter is a separate entry.
What happens with duplicate query parameter keys?
Duplicate keys are returned as an array. For example, ?tag=a&tag=b produces { tag: ["a", "b"] }.
Does it handle relative URLs?
The API expects absolute URLs with a protocol. Relative paths like "/page?q=1" return an error.
Are internationalized domain names supported?
Yes. The API handles IDN (punycode) domains and decodes them in the response.

Get your API key

Free tier includes 5 requests per minute with no credit card required. Upgrade for higher limits.