# agent402.tools CIDR Block Parser

> agent402.tools CIDR Block 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-15).

Parses an IPv4 CIDR block to return network address, broadcast, first/last host, netmask, and host count, with optional IP membership testing.

## Facts

- Endpoint: POST https://agent402.tools/api/cidr
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/agent402-tools-cidr-block-parser-cdee9059
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_HwO53VUdxkjy4qgKZZs3j

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-cidr-block-parser-cdee9059 -d '<json body>'
```

Example prompt: Can you parse the CIDR block 10.0.0.0/22 and tell me the network address, broadcast, first and last host, netmask, and total host count? Also check if 10.0.3.255 is inside it.

## When to prefer this

Use this endpoint when an agent needs precise subnet arithmetic for an IPv4 CIDR block — especially when both structural details (network/broadcast/host range/mask) and optional IP-in-range membership testing are needed in a single call. Prefer it over manual computation or general-purpose code execution when a lightweight, pay-per-use network utility is sufficient.

## Known failure modes

- Invalid CIDR notation (e.g. missing prefix length or malformed IP) results in an error response
- IPv6 CIDR blocks are not supported
- The optional 'contains' field with an invalid IP format may return an error or null membership result
- Payment failure via x402 protocol blocks the request entirely

## How this service works

Parse an IPv4 CIDR block: network address, broadcast, first/last host, netmask, and host count. Optionally test if an IP is inside it.

## Output

Returns a structured object with the network address, broadcast address, first usable host IP, last usable host IP, subnet mask, total number of hosts, and optionally a boolean indicating whether the provided IP falls within the CIDR range.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "cidr": {
   "type": "string"
  },
  "contains": {
   "type": "string",
   "description": "Optional IP to test for membership"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "cidr": "192.168.1.0/24",
  "prefix": 24,
  "netmask": "255.255.255.0",
  "network": "192.168.1.0",
  "contains": true,
  "lastHost": "192.168.1.254",
  "broadcast": "192.168.1.255",
  "firstHost": "192.168.1.1",
  "usableHosts": 254,
  "totalAddresses": 256
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/agent402-tools-cidr-block-parser-cdee9059/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)
