Skip to content
AI Dev Toolkit.
Esc
  • AI Token CounterCount tokens for GPT, Claude, Gemini, DeepSeek, Qwen and more.Tool
  • LLM API Cost CalculatorEstimate per-request, daily and monthly API costs.Tool
  • AI Model ComparisonCompare prices, context windows and features across models.Tool
  • AI Model Pricing PagesSpecs, real costs and cheaper alternatives for popular models.Tool
  • Context Window CheckerSee whether your text fits each model’s context window.Tool
  • Subscription vs API CalculatorFind out whether a chat plan or the API is cheaper for you.Tool
  • GPU / VRAM CalculatorCheck how much VRAM a local model needs and which GPUs fit.Tool
  • Prompt Caching CalculatorEstimate savings from prompt caching.Tool

Prompt template · Design and security

API design review prompt

Review a proposed API for naming, errors, pagination, idempotency and backwards compatibility before it ships. 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 prompt

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.

Prompt (one message, plain text)
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.

System prompt
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>
User message
<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 to put in each variable

{{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 to use it

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 it’s 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

A filled-in example

{{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)
Filled-in prompt
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

Tips by model family

  • 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.

Related

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.