# agent402.tools URL Parser

> agent402.tools URL Parser is a paid API for AI agents from agent402.tools, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-14).

Parses a URL string into its constituent components including protocol, host, port, path, decoded query parameters, hash, origin, and punycode hostname.

## Facts

- Endpoint: POST https://agent402.tools/api/url-parse
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/agent402-tools-url-parser-bdf6005d
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_YiiJM0NqtFc-heGXaD6NG

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability agent402-tools-url-parser-bdf6005d -d '<json body>'
```

Example prompt: Can you break down 'https://example.com:8080/search?q=hello+world&lang=en#results' into all its parts — protocol, host, port, path, decoded query params, hash, and origin?

## When to prefer this

Use this endpoint when you need to programmatically decompose a URL into structured fields, especially when you need decoded query parameters or punycode hostname normalization. Prefer this over manual string splitting for reliable, standards-compliant URL parsing.

## Known failure modes

- Malformed or non-URL string input returns an error
- Missing required 'url' field in request body returns validation error
- Relative URLs without a scheme may fail to parse correctly

## How this service works

Parse a URL into components: protocol, host, port, path, query params (decoded), hash, origin, punycode hostname.

## Output

Returns a structured breakdown of the URL with fields for protocol, host, port, path, decoded query parameters as key-value pairs, hash fragment, origin, and punycode-encoded hostname.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "url": {
   "type": "string",
   "description": "URL to parse"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "hash": "#frag",
  "port": "8080",
  "query": {
   "x": "1",
   "y": "hello world"
  },
  "hostname": "ex.com",
  "pathname": "/a/b",
  "protocol": "https:"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/agent402-tools-url-parser-bdf6005d/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agent402.tools](https://www.zero.xyz/host/agent402.tools/llms.txt)
