REST API Endpoint Designer
Design an endpoint properly: resource shape, status codes, pagination, idempotency, error bodies, and the versioning decision you will regret skipping.
The Prompt — replace [BRACKETS] with your details
Act as an API designer who has maintained public APIs for years. Design an endpoint. What it needs to do: [DESCRIBE THE OPERATION IN PLAIN LANGUAGE] Context: - Existing API conventions: [PASTE ONE OR TWO EXAMPLE ENDPOINTS FROM MY API, OR SAY "greenfield"] - Consumers: [FIRST-PARTY WEB APP / MOBILE / THIRD-PARTY DEVELOPERS] - Auth model: [BEARER TOKEN / SESSION / API KEY / OTHER] - Expected volume and payload size: [ROUGH NUMBERS] - Data model involved: [TABLES OR ENTITIES AND KEY FIELDS] Deliver: 1. The method and path, following my existing conventions, with two alternatives considered and rejected — say why 2. The request: path and query parameters, body schema with types and which fields are required, and validation rules 3. The response: schema for success, the exact status code, and what is deliberately not returned 4. Every error case with its status code and a consistent error body shape, including validation errors with field-level detail 5. Pagination, filtering, and sorting if this returns a collection — with the reason for cursor versus offset in my case 6. Idempotency: whether this operation needs an idempotency key, and what happens on a retry 7. Authorisation: who can call this, and what a user must not be able to see or change by manipulating IDs 8. Rate limiting and caching headers 9. The versioning and backwards-compatibility question: what would be a breaking change to this endpoint later 10. Example curl requests: one success, two failures Point out anything in my description that is ambiguous rather than choosing for me silently.
How to use this prompt
- Paste a real endpoint from your API — consistency with what exists matters more than abstract best practice.
- Take section 7 seriously and test it: object-level authorisation is the most commonly shipped API bug.
- Keep the error body shape identical across every endpoint, even when it feels verbose.
Why this prompt works
Endpoint design fails on the parts that are invisible on the happy path — errors, retries, pagination, authorisation. Enumerating them explicitly forces decisions at design time, when changing them is free, rather than after third parties depend on the shape.
Variations to try
- Ask for the same design as a GraphQL mutation or an RPC method to compare trade-offs.
- Ask it to write the OpenAPI specification fragment for the finished design.
- Add "this replaces an existing endpoint with live consumers" for a migration and deprecation plan.
Common mistakes to avoid
- Returning 200 with an error inside the body, which breaks every client's error handling.
- Offset pagination on a large, frequently changing collection, so rows are skipped and duplicated.
- Checking that a user is logged in but not that the record belongs to them.
Works well with
Need a custom version of this prompt?
The free prompt generator builds a prompt tailored to your exact goal, framework, and target AI model — or paste this template into the optimizer to refine it.
Related prompts
Code Review Assistant
Paste code and get a structured review covering bugs, readability, performance, and securi…Debug Any Error Message
Paste an error message and the related code to get the likely root cause, a fix, and how t…Unit Test Generator
Generate thorough unit tests for any function, covering happy paths, edge cases, and failu…Code Documentation Writer
Generate clear docstrings, inline comments where needed, and a README-style usage section …Sponsored
Revenue Signal
Visitor → payment → MRR
MRR
$9.4k
+18%
ARR
$112k
run rate
Net New
+$1.7k
this month
Subs
192
active
ARPU
$49
per account
Churn
3.2%
watchlist
new MRR
+$1.9k
expansion
+$620
reactivation
+$210
churn + contraction
-$790
Failed Payments
$820 at risk
Open Metrics
public page ready
Click-worthy signal
Turn the traffic your content earns into real revenue — see which visitors actually convert.
Find my MRR signal →