The worst part of API design is not the code. It is the twenty small decisions nobody wrote down: what a resource is called, whether updates use PATCH or PUT, what an error body looks like, how pagination behaves on the last page. Six weeks later those decisions come back as a breaking change. These seven ChatGPT prompts for API design force each decision into the open while it is still cheap to change.
Quick checklist
- — Resources are nouns, and every endpoint maps to one of them.
- — Every list endpoint has a documented pagination rule.
- — Errors share one shape, with a stable machine-readable code.
- — Auth is decided per endpoint, not globally by accident.
- — Versioning and deprecation have a written policy.
- — Field names use one casing convention across the whole surface.
The prompts
1. Resource model from a rough brief
Here is what my product does: [product description]. List the core resources an API would expose, with a one-line definition and the relationships between them.
What it does: Extracts nouns from a feature description so endpoints stop being action names.
How to use: Replace [product description]; delete any resource nobody would ever fetch on its own.
2. Endpoint table with verbs
For these resources: [resource list]. Give me a table of endpoints with method, path, purpose, and whether it is idempotent.
What it does: Produces the skeleton of the API in one pass, including the awkward ones.
How to use: Replace [resource list]; question every POST that could be a PUT.
3. Request and response schema
Write a JSON schema for the [resource name] create request and its response. Mark required fields, add types, and note which fields are server-generated.
What it does: Makes the contract explicit instead of leaving it in someone’s head.
How to use: Replace [resource name]; check that no client can set an ID or timestamp.
4. Error body convention
Design an error response format for my API. Include a stable code, a human message, a field pointer for validation failures, and a request id. Show one example per case.
What it does: Gives every failure the same shape, so clients write one handler.
How to use: Adjust the field names to your existing style; publish the codes in the docs.
5. Pagination and filtering rules
Write the pagination and filtering convention for a list endpoint returning [resource name]. Cover cursor format, page size limits, sort order, and what happens on the last page.
What it does: Prevents the classic bug where a client loops forever on the final page.
How to use: Replace [resource name]; decide cursor versus offset before you document it.
6. Versioning and deprecation policy
Draft a versioning policy for an API consumed by [client types]. Explain how breaking changes ship, how long old versions live, and how deprecation is announced.
What it does: Sets expectations before the first painful migration.
How to use: Replace [client types]; make the timelines match what your team can actually support.
7. Consistency review of an existing spec
Review this API spec for consistency: [paste spec or endpoint list]. Flag naming mismatches, inconsistent status codes, and missing error cases. Suggest fixes in a table.
What it does: Catches the drift that builds up after a year of small additions.
How to use: Paste your spec under [paste spec]; fix the naming issues first, since they are hardest to change later.
How to score your own output
- A frontend developer can call any endpoint from the docs without asking you a question.
- Two endpoints that do the same kind of thing look the same on paper.
- Removing a field would be a versioned change, not a surprise.
Keep going
- Browse the Coding prompt library
- Gemini prompts for database schemas
- ChatGPT prompts for unit tests
- Claude prompts for CSV imports
Every prompt on GuPrompt is free to copy — no signup, no paywall.