Prompt template · Design and security
API design review prompt
A good API design review prompt gives the model your existing conventions and the proposed endpoints, then checks naming, methods and status codes, errors, pagination, filtering, idempotency, versioning and backwards compatibility. This template ranks findings by how hard they are to fix after launch and shows a corrected request or response for each one.
Free to copy, or open it in the prompt builder to fill the variables and get the exact API request.
248 tokens unfilled · 377 with the example below · o200k_base (GPT-4o and later)
Template
The API design review prompt template (copy it)
Paste this into a chat window and replace each {{variable}}, or open it in the prompt builder to fill them in a form. Sections are marked with XML tags, which every major model reads well.
You are an API designer who has maintained public APIs for years. You care about consistency, clear errors and never breaking existing clients.
<context>
Our existing API conventions:
<conventions>
{{conventions}}
</conventions>
The proposed API (OpenAPI, example requests or a description):
<proposal>
{{proposal}}
</proposal>
</context>
<constraints>
- Check against our conventions first, then general practice for {{api_style}} APIs.
- Cover: resource and field naming, HTTP methods and status codes, error format, pagination, filtering, idempotency of writes, versioning and backwards compatibility.
- Prioritise problems that would be breaking changes to fix after launch.
- For each issue, show the corrected request or response, not just the principle.
- If the conventions and general practice disagree, follow the conventions and mention the difference.
</constraints>
<output_format>
A numbered list grouped as: must fix before launch, should fix, consider. Each item: the issue in one line, why it matters, and a corrected example.
</output_format>
<task>
Review this API design before it is built. Find inconsistencies, ambiguities and decisions that will be hard to change later.
</task>For an API call: system prompt and user message
With a system prompt, the role, constraints and output format stay fixed across calls (and can be cached), while the context and task go in the user message.
You are an API designer who has maintained public APIs for years. You care about consistency, clear errors and never breaking existing clients.
<constraints>
- Check against our conventions first, then general practice for {{api_style}} APIs.
- Cover: resource and field naming, HTTP methods and status codes, error format, pagination, filtering, idempotency of writes, versioning and backwards compatibility.
- Prioritise problems that would be breaking changes to fix after launch.
- For each issue, show the corrected request or response, not just the principle.
- If the conventions and general practice disagree, follow the conventions and mention the difference.
</constraints>
<output_format>
A numbered list grouped as: must fix before launch, should fix, consider. Each item: the issue in one line, why it matters, and a corrected example.
</output_format><context>
Our existing API conventions:
<conventions>
{{conventions}}
</conventions>
The proposed API (OpenAPI, example requests or a description):
<proposal>
{{proposal}}
</proposal>
</context>
<task>
Review this API design before it is built. Find inconsistencies, ambiguities and decisions that will be hard to change later.
</task>Variables
What do the variables mean?
- {{conventions}}
- Your API style rules: casing, error body shape, pagination style, ID format, date format. Paste your style guide or two existing endpoints if you have no guide.
- {{proposal}}
- The proposed endpoints as an OpenAPI fragment, example requests and responses, or a clear description.
- {{api_style}}
- The kind of API, such as REST with JSON, GraphQL or gRPC.
Use
When should I use this API design review prompt?
Use it on a design before implementation, when changes are cheap. It is most valuable for public or partner APIs, where every field name and error code becomes a promise to clients that is expensive to break.
For internal endpoints that only one client uses, a lighter review is fine; you can change both sides together. The template still helps with consistency, which matters even internally once an API has several consumers.
Structure
Why is the prompt structured this way?
Existing conventions come first because consistency beats any individual best practice. An API that uses snake_case everywhere shouldn’t gain a camelCase endpoint, even if the model prefers it. The rule for conflicts makes the priority explicit.
The checklist names the areas where API designs most often go wrong, and the instruction to prioritise breaking changes reflects real cost: a confusing error message can be fixed any time, but renaming a field or changing pagination style after launch breaks clients.
Corrected examples instead of principles make each finding actionable. “Use consistent errors” is advice; a corrected JSON error body is a decision the team can accept or reject in review.
Example
Example: a filled-in API design review prompt
- {{conventions}}
snake_case fields. Errors are { "error": { "code": "string", "message": "string" } }. Cursor pagination with ?cursor= and a next_cursor field. IDs are strings with a prefix, such as inv_123.- {{proposal}}
POST /createInvoice { "customerId": 123, "amount": 49.99, "currency": "usd" } → 200 { "invoiceId": 987 } GET /invoices?page=2 → 200 [ { "invoiceId": 987, "amount": 49.99 } ] Errors: 200 { "success": false, "msg": "customer not found" }- {{api_style}}
REST with JSON
What to look for. Almost everything here conflicts with the conventions: a verb in the path, camelCase fields, numeric IDs, page-based pagination, a bare array that can’t be extended, errors returned with status 200, and money as a float. A good review puts the array response, the IDs and the pagination in “must fix”, since all three are breaking to change later.
The complete filled-in prompt (377 tokens)
You are an API designer who has maintained public APIs for years. You care about consistency, clear errors and never breaking existing clients.
<context>
Our existing API conventions:
<conventions>
snake_case fields. Errors are { "error": { "code": "string", "message": "string" } }. Cursor pagination with ?cursor= and a next_cursor field. IDs are strings with a prefix, such as inv_123.
</conventions>
The proposed API (OpenAPI, example requests or a description):
<proposal>
POST /createInvoice
{ "customerId": 123, "amount": 49.99, "currency": "usd" }
→ 200 { "invoiceId": 987 }
GET /invoices?page=2
→ 200 [ { "invoiceId": 987, "amount": 49.99 } ]
Errors: 200 { "success": false, "msg": "customer not found" }
</proposal>
</context>
<constraints>
- Check against our conventions first, then general practice for REST with JSON APIs.
- Cover: resource and field naming, HTTP methods and status codes, error format, pagination, filtering, idempotency of writes, versioning and backwards compatibility.
- Prioritise problems that would be breaking changes to fix after launch.
- For each issue, show the corrected request or response, not just the principle.
- If the conventions and general practice disagree, follow the conventions and mention the difference.
</constraints>
<output_format>
A numbered list grouped as: must fix before launch, should fix, consider. Each item: the issue in one line, why it matters, and a corrected example.
</output_format>
<task>
Review this API design before it is built. Find inconsistencies, ambiguities and decisions that will be hard to change later.
</task>Models
Does it work the same in ChatGPT, Claude and Gemini?
Yes, the structure works in all three: tagged sections that keep your material apart from the instructions, and an explicit output format. The tips below cover where the providers’ own guides differ for this API design review prompt.
- All models
Paste an OpenAPI fragment if you have one. It is precise about types, required fields and status codes, so the review can be precise too.
- Gemini
Google recommends giving Gemini examples whose structure is identical to what you want. If you review APIs regularly, include one past review in the exact format of the output list.
- Claude
Anthropic recommends XML tags to keep instructions apart from data. Keep the conventions and the proposal in separate tags, as here, so Claude never mistakes a proposed field for one of your rules.
FAQ
Questions people ask
Can ChatGPT review an OpenAPI spec?
Yes. Paste the OpenAPI fragment into the proposal variable; it is precise about types, required fields and status codes, so the review can be precise too. Add your conventions, such as casing, error body shape and pagination style, because consistency with your own API matters more than any general rule.
How do I spot breaking changes before launch?
Ask for them first. The template prioritises problems that would be breaking to fix later, such as a bare array response that can’t gain fields, numeric IDs or page-based pagination. A confusing error message can be fixed any time; renaming a field after clients depend on it breaks those clients.
What if our conventions disagree with general REST practice?
The template follows your conventions and mentions the difference. An API that uses snake_case everywhere shouldn’t gain one camelCase endpoint, even if the model prefers it. Seeing the difference written down lets the team decide whether to change the convention, which is a separate decision from this endpoint.
Related
Related prompts and system prompts
- Architecture decision recordTurn design discussion notes into a short ADR: context, options, decision and consequences.
- Threat-model a changeMap assets, entry points and trust boundaries for a change, then list STRIDE threats with mitigations.
- Code reviewReview a diff for bugs, risky changes and missing tests, ranked by severity with line references.
Also useful with this prompt: Postman MCP server.
Edited the template? Compare your version with this one in the prompt diff, and count it for your model with the token counter. Browse all 29 prompt templates.
Keep exploring