Design REST API endpoints the clean way
An AI prompt for REST API endpoint design — resources, routes, request and response shapes, errors, pagination, auth and versioning.
- Published
- Works with
- ChatGPT, Claude and Gemini
- Level
- Intermediate
APIs are hard to change once clients depend on them, so early design decisions about naming, errors and pagination matter. Inconsistent endpoints and ad-hoc error formats cause bugs for years. This prompt turns your feature requirements into a REST API endpoint design with consistent conventions you can review before writing code.
The prompt
Act as a senior backend engineer and API designer. Design REST API endpoints.
Product and feature:
Main entities and relationships:
Who calls the API (web app, mobile, third parties):
Actions users need:
Auth method: [AUTH, e.g. OAuth 2, API keys, session]
Existing conventions to follow:
Deliver:
1. Resource list and URL structure.
2. Endpoint table: method, path, purpose, auth/permissions.
3. Request and response JSON examples for the main endpoints.
4. A consistent error format with example error codes and HTTP status codes.
5. Pagination, filtering and sorting approach.
6. Idempotency, rate limiting and versioning recommendations.
7. An OpenAPI 3 snippet for two endpoints.
8. Design trade-offs I should decide on and open questions.
Prefer standard REST conventions; explain any place you deviate.
How to use it
- List real use cases, not just entities, so endpoints match how clients work.
- Review the open questions with frontend and mobile developers.
- Generate the full OpenAPI spec once the design is agreed.
Tips
- Plan the storage with the database schema design prompt.
- Document the finished API with the API documentation from code prompt.
Frequently asked questions
What does this prompt do?
An AI prompt for REST API endpoint design — resources, routes, request and response shapes, errors, pagination, auth and versioning.
Which AI tools does it work with?
It is written for ChatGPT, Claude and Gemini. It also works in other AI tools that accept text prompts, with small changes.
What do I need to fill in?
5 blanks: feature; entities; clients; use cases; conventions or "none". Click each blue blank on the page, type your details and press Copy prompt.
Is this prompt free to use?
Yes. You can copy and use it for personal and commercial work.