How I Mapped an Undocumented Vendor API in 2 Days With Claude Code A developer used Anthropic's Claude Code to reverse-engineer an undocumented vendor billing API in two days, turning roughly 40 exploratory HTTP requests into an inferred schema, a typed client, and a contract test suite. The key constraint was that the agent inferred types only from captured responses, never from vendor documentation, to avoid hallucinated fields. The approach involved a four-stage loop where the agent proposed probes, the harness executed and recorded responses to disk, the agent inferred schemas from those captures, and contract tests validated against them. A vendor handed us a sandbox key, a 6-page PDF, and no OpenAPI spec. I used Claude Code to turn ~40 exploratory requests into an inferred schema, a typed client, and a contract test suite in two days. The trick was never letting the agent write types from the docs — only from captured responses. Here's the loop, plus the three times it confidently made things up. We had to integrate a partner's billing API. What we got was: No OpenAPI spec. No Postman collection. No SDK. The PDF said amount was "an integer," which turned out to mean minor units as a string in three of the seven endpoints. It listed six fields on the invoice object; the real payload had thirty-one. I've been down this road before, and the usual failure mode is nasty: you write a client against the docs, it works in sandbox, and then production returns a nullable field the docs never mentioned and your parser explodes at 2 AM. The docs aren't the contract. The responses are the contract. So my constraint going in was simple: I wanted an integration where every type, every enum, and every nullability decision could be traced back to a real HTTP response I had actually observed — not to prose in a PDF, and not to a language model's prior about what a billing API "usually" looks like. That second one matters more than people expect. If you paste a vague doc into an agent and ask for a TypeScript client, you will get a beautiful client. It will have status: 'pending' | 'paid' | 'failed' because that's what billing APIs usually have. The vendor's actual enum was PENDING | SETTLED | REVERSED | PARTIAL REVERSED . Everything compiles. Nothing works. The whole thing is a four-stage loop. The agent is allowed to be creative in stages 1 and 3, and is aggressively constrained in stages 2 and 4. php flowchart LR A Agent proposes