
- Updated
Design a REST API for your app
This prompt helps you design a REST API. You describe the app, its main resources and how auth works, and it lists endpoints with method, path and purpose, with request and response examples.
Help me design a REST API. App: [WHAT IT DOES] Main resources: [e.g. users, orders, products] Auth: [JWT / SESSION / NONE] List endpoints (method, path, purpose), request and response JSON examples for 3 of them, error format, pagination approach and status codes to use. Follow REST conventions and point out anything I may have missed.
Ask for an OpenAPI (YAML) version once the design looks right.
Get a better result
A first draft of your API: a table of endpoints with method, path and purpose, sample request and response JSON for three of them, one error format, a pagination plan, the status codes to use and a short list of things you forgot.
Naming the resources and the auth type up front stops the model from inventing a generic shop or blog API. Asking for full JSON examples on only three endpoints keeps the answer short enough to read, while still showing the shape every other endpoint will copy. The last line, “point out anything I may have missed”, turns it from a typist into a reviewer.
The endpoints use verbs, like /createOrder and /getUsers.
Fix: Ask it to name resources as plural nouns and let the HTTP method carry the action, so POST /orders creates and GET /users lists.
- Every list endpoint returns everything at once. Say how big the lists can get, for example “a shop can have 50,000 orders”, and ask for cursor or page based pagination with a default page size.
- Errors come back in a different shape on each endpoint. Ask for one error object used everywhere, with a machine code, a human message and the field that failed, and make the examples show it.
Ask how to add a breaking change later without hurting existing clients, and whether a version in the path or in a header suits your app better.
Now write this design as an OpenAPI 3 YAML file, with the request and response schemas and the shared error object.
More chat & writing prompts
See all 465 →More like this
- Create TypeScript types from a JSON responseClaude · ChatGPT · Gemini
- Mock an external API in your testsClaude · ChatGPT · Gemini
- Speed up a slow API endpoint or functionClaude · ChatGPT · Gemini
- Write a Dockerfile for your appClaude · ChatGPT · Claude Code
- Design a database schemaChatGPT · Gemini · Claude



