# x402 Doctor – Fix Endpoint

> x402 Doctor – Fix Endpoint is a paid API for AI agents from x402-doctor.onrender.com, paid per call via x402, $0.05/call, status unknown (last checked 2026-10-10).

Diagnoses an x402-protected HTTP endpoint and returns concrete, stack-specific code fixes for every detected problem, pre-filled with the caller's own payTo, amount, network, and route.

## Facts

- Endpoint: GET https://x402-doctor.onrender.com/api/v1/fix?utm_source=zero.xyz
- Price: $0.05/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-10
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/x402-doctor-fix-endpoint-a2420c9b
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_4J2MmJxM_EJAcHXkVzMXU

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-doctor-fix-endpoint-a2420c9b
```

Example prompt: My Express x402 payment endpoint at https://myapi.example.com/premium is broken — can you diagnose it and give me the exact code fixes I need to make it work?

## When to prefer this

Choose this endpoint when you already know your x402 endpoint URL and want actionable, code-level fixes rather than just a diagnosis report. It goes beyond the sibling /diagnose endpoint by generating concrete, copy-paste code snippets tailored to your specific framework (Express, Next.js, Hono, or raw HTTP), pre-filled with your actual payTo address, amount, network, and route — saving significant manual debugging time.

## Known failure modes

- URL is not publicly reachable — endpoint returns connection error
- Provided URL is not an x402 endpoint at all — no 402 response detected
- Stack auto-detection fails if no identifying headers are present — caller should specify stack explicitly
- Endpoint requires authentication before returning 402 — doctor cannot probe it
- Transient Render.com cold-start latency on first call

## How this service works

The fix for your x402 endpoint: diagnoses it, then returns per problem the concrete change as code for your stack (Express, Next.js, Hono or raw HTTP), filled in with your own payTo, amount, network and route.

## Output

Returns an overall status (pass/warn/fail), a summary, the detected stack, and an array of fixes — each with a title, severity, explanation of why it's a problem, numbered steps to resolve it, ready-to-paste code snippets in the caller's framework, verification checks, and any unfixed issues that couldn't be auto-remediated.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "url"
     ],
     "properties": {
      "url": {
       "type": "string",
       "description": "Your x402 endpoint (public http(s) URL)."
      },
      "stack": {
       "enum": [
        "express",
        "next",
        "hono",
        "node",
        "python",
        "generic"
       ],
       "type": "string",
       "description": "Your stack, if detection from response headers is wrong. Default: detected."
      },
      "method": {
       "enum": [
        "GET",
        "POST"
       ],
       "type": "string",
       "description": "HTTP method of the endpoint. Default: try GET, then POST."
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "required": [
      "url",
      "fixes"
     ],
     "properties": {
      "url": {
       "type": "string"
      },
      "fixes": {
       "type": "array",
       "items": {
        "type": "object",
        "required": [
         "title",
         "why",
         "steps",
         "code"
        ],
        "properties": {
         "why": {
          "type": "string"
         },
         "code": {
          "type": "array",
          "items": {
           "type": "object",
           "properties": {
            "label": {
             "type": "string"
            },
            "stack": {
             "type": "string"
            },
            "snippet": {
             "type": "string"
            },
            "language": {
             "type": "string"
            }
           }
          }
         },
         "steps": {
          "type": "array",
          "items": {
           "type": "string"
          }
         },
         "title": {
          "type": "string"
         },
         "checks": {
          "type": "array",
          "items": {
           "type": "string"
          }
         },
         "recipe": {
          "type": "string"
         },
         "verify": {
   
… (truncated)
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "url": "https://x402-doctor.onrender.com/demo/broken",
  "fixes": [
   {
    "why": "x402 amounts are integer strings in the smallest unit.",
    "code": [
     {
      "label": "Option field",
      "stack": "generic",
      "snippet": "\"amount\": \"10000\"",
      "language": "json"
     }
    ],
    "steps": [
     "Use price: \"$0.01\" instead of an amount."
    ],
    "title": "Amount \"0.01\" → \"10000\" ($0.01)",
    "checks": [
     "accepts[0]-amount"
    ],
    "recipe": "amount",
    "verify": "Run x402 Doctor again.",
    "severity": "warn"
   }
  ],
  "stack": {
   "id": "express",
   "name": "Express (@x402/express)",
   "detected_from": "x-powered-by: Express"
  },
  "overall": "fail",
  "summary": "1 fix (0 blocking), for Express (@x402/express).",
  "unfixed": []
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/x402-doctor-fix-endpoint-a2420c9b/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402-doctor.onrender.com](https://www.zero.xyz/host/x402-doctor.onrender.com/llms.txt)
