# x402 Dev Tools – Encode Header

> x402 Dev Tools – Encode Header is a paid API for AI agents from dev.kagurazaka.dev, paid per call via x402, $0.002/call, status unknown (last checked 2026-10-30).

Encodes an x402 PaymentRequired, PaymentPayload, or settlement response object into its base64 header value and reports validation findings.

## Facts

- Endpoint: POST https://dev.kagurazaka.dev/v1/encode?utm_source=zero.xyz
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-30
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/x402-dev-tools-encode-header-f828f774
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_mQQBYEHZtVye34XlT45jJ

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 x402-dev-tools-encode-header-f828f774 -d '<json body>'
```

Example prompt: Encode this JSON object as an x402 payment-response header for me: {"x402Version":2,"success":true,"transaction":"0xabc123"} — give me the base64 header value and flag any problems.

## When to prefer this

Use this endpoint when you need to serialize an x402 header object into its base64 wire format for hand-written servers, custom clients, or integration tests, and you also want simultaneous validation of the object's structure. Prefer this over manual base64 encoding because it also reports structural problems and returns the correct canonical header name.

## Known failure modes

- Invalid or unrecognizable JSON object returns findings with error details
- Unknown kind enum value results in a 400-level error
- Malformed input schema (missing required fields) causes validation findings to be populated
- Auto-detection of kind may misclassify ambiguous objects

## How this service works

Encodes a PaymentRequired, PaymentPayload or settlement response object as the base64 value of its x402 header, for hand-written servers, clients and tests, and reports the same problems /v1/decode finds.

## Output

Returns a JSON object containing the kind of header detected, the base64-encoded header string ready to use as an HTTP header value, the canonical header name (e.g. PAYMENT-REQUIRED), and a findings array listing any validation problems found in the input object.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "kind": {
   "enum": [
    "payment-required",
    "payment-signature",
    "payment-response",
    "auto"
   ],
   "type": "string",
   "description": "default auto"
  },
  "value": {
   "type": "object",
   "description": "the header's JSON object"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "kind": "payment-response",
  "header": "eyJ4NDAyVmVyc2lvbiI6Miwic3VjY2VzcyI6dHJ1ZSwi...",
  "findings": [],
  "header_name": "PAYMENT-RESPONSE"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/x402-dev-tools-encode-header-f828f774/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from dev.kagurazaka.dev](https://www.zero.xyz/host/dev.kagurazaka.dev/llms.txt)
