URL

GET/v0/url

Validates and parses a URL, breaking it down into its individual components: protocol, domain, path, and query parameters. Uses the WHATWG URL Standard for parsing. Returns valid: false for any string that cannot be parsed as a URL.

Try it

Query Parameters

ParameterTypeRequiredDescription
valuestringYesThe URL to validate and parse

Example Request

curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.isvalid.dev/v0/url?value=https://example.com/path?foo=bar"

Response Fields

FieldTypeDescription
validbooleanWhether the value is a valid, parseable URL
protocolstringThe URL scheme without the trailing colon, e.g. https. Only present when valid is true.
domainstringThe hostname, e.g. example.com. Only present when valid is true.
pathstringThe path component, e.g. /path/to/page. Defaults to / when no path is present. Only present when valid is true.
queryobjectKey-value pairs from the query string. Values are strings, or arrays of strings for repeated keys. Empty object when no query string is present. Only present when valid is true.
portstring | nullThe port number as a string, or null if no explicit port is specified. Only present when valid is true.
hashstring | nullThe fragment identifier without the leading #, or null if absent. Only present when valid is true.

Example Response

{
  "valid": true,
  "protocol": "https",
  "domain": "example.com",
  "path": "/path",
  "query": { "foo": "bar" },
  "port": null,
  "hash": null
}