Reverse-engineer a contract from undocumented API calls
When you inherit integration code with no docs, reconstructing the implicit API contract from raw requests and responses saves hours of trial-and-error. This prompt systematizes that process.
You are a backend engineer reverse-engineering an undocumented third-party API. I will give you a set of captured HTTP request/response pairs. Your job is to infer the API contract.
API base URL or name: {{API_NAME_OR_URL}}
Captured request/response pairs (paste all of them):
```
{{RAW_HTTP_SAMPLES}}
```
Work through these steps:
1. Identify all distinct endpoints (method + path). Group the samples by endpoint.
2. For each endpoint, infer:
a. Required vs. optional request parameters (headers, query params, body fields).
b. Data types and observed value ranges for each field.
c. Response schema: field names, types, and any nullable or conditional fields.
3. Note any patterns suggesting authentication, rate limiting, pagination, or versioning.
4. Flag fields whose purpose is ambiguous — do not guess; mark them as 'unknown intent'.
5. Output a concise contract summary in plain English, then provide a matching OpenAPI 3.0 YAML stub covering the inferred endpoints.
6. List assumptions you made and what additional samples would resolve remaining uncertainty. {{API_NAME_OR_URL}}{{RAW_HTTP_SAMPLES}}
How to use this prompt
- Copy the prompt above (Copy button on the top-right).
- Replace each
{{VAR}}with your own value. Variables:{{API_NAME_OR_URL}}{{RAW_HTTP_SAMPLES}}. - Paste it into one of the recommended tools below.
- Iterate: tighten constraints in the prompt if the output is generic.
Why this prompt is structured this way
The prompt is split into explicit steps because LLMs do better when the path is named, not implied. Each variable forces specificity at the input layer — vague inputs get vague outputs.
Pair this prompt with a tool
Cursor
$20/moAI-first code editor forked from VS Code.
Cursor is VS Code with first-class LLM integration. Multi-file edits, codebase Q&A, autocomplete that's actually useful. The default IDE for many shipping engineers in 2026.
Claude (Anthropic)
$0/mo (Pro at $20)Frontier model with long context and strong reasoning.
Claude (Opus / Sonnet / Haiku tiers) is the assistant favored by writers and engineers who care about reasoning quality and tone. 1M token context on Opus.
ChatGPT (OpenAI)
$0/mo (Plus at $20)The category-defining general-purpose AI assistant.
ChatGPT has the broadest feature surface: image gen, voice, custom GPTs, web browsing, code execution. Often the right default; sometimes beaten on specific tasks by Claude or Perplexity.
The PlaybookPrompts weekly
One short email per week. The five sharpest prompts we found, one tool worth your attention, one anti-pattern to avoid. Unsubscribe in one click.
Newsletter signup is not configured. Set PUBLIC_NEWSLETTER_USERNAME in the build env.