{"uid":"cap_4J2MmJxM_EJAcHXkVzMXU","slug":"x402-doctor-fix-endpoint-a2420c9b","name":"x402 Doctor – Fix Endpoint","description":"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.","url":"https://x402-doctor.onrender.com/api/v1/fix?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"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":{"type":"string"},"severity":{"enum":["fail","warn"],"type":"string"}}}},"stack":{"type":"object","properties":{"id":{"enum":["express","next","hono","node","python","generic"],"type":"string"},"name":{"type":"string"},"detected_from":{"type":"string"}}},"overall":{"enum":["pass","warn","fail"],"type":"string"},"summary":{"type":"string"},"unfixed":{"type":"array","items":{"type":"object"}}}}}}}},"responseSchema":{"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":[]}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.05","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.05/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.05","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.05","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_cM8-WeVO4B3TDOcBO6HXS","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.05","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"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.","exampleAgentPrompt":"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?","exampleUseCases":[{"title":"Fix broken Express x402 payment wall","prompt":"My Express.js x402 endpoint at https://api.myapp.com/gated isn't responding correctly to payment challenges. Can you diagnose it and give me the exact code snippets to fix it?"},{"title":"Debug Next.js x402 route implementation","prompt":"I built a Next.js API route at https://nextapp.vercel.app/api/premium with x402 but clients can't pay — diagnose what's wrong and show me the corrected Next.js code to fix each issue."},{"title":"Validate Hono x402 middleware setup","prompt":"Check my Hono x402 endpoint at https://hono-app.workers.dev/paid and tell me everything that's misconfigured, with working Hono code snippets I can paste in to fix each problem."}],"resultDescription":"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.","failureModes":["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"],"whenToPreferThis":"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.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-10T18:35:57.639Z","isFirstParty":false,"canonicalSlug":"x402-doctor-fix-endpoint-a2420c9b"}