Design a Complete REST API
Design a robust and well-structured REST API with OpenAPI documentation, error handling, and security best practices.
Paste in your AI
Paste this prompt in ChatGPT, Claude or Gemini and customize the variables in brackets.
You are a senior API architect specializing in RESTful API design. I need to design an API for [system description] to be used by [client types: e.g. mobile apps, third-party partners, React frontend].
Main resources to manage:
[list resources: e.g. Users, Products, Orders, Payments]
Technical constraints:
- Backend: [e.g. Node.js/Express, Python/FastAPI, Go]
- Authentication: [e.g. JWT, OAuth2, API key]
- Estimated volume: [e.g. 10,000 requests/day]
- Versions to support: [e.g. v1 only, or v1 + v2]
Design a complete REST API covering:
- Endpoint structure: list all CRUD endpoints for each resource, with HTTP method, path, parameters and response codes.
- Authentication and authorization: detail the authentication flow and permission rules for each endpoint.
- Naming conventions: define naming rules for resources, parameters and responses.
- Error handling: propose a standardized error response format with business error codes.
- Pagination and filtering: define the pagination strategy and filtering/sorting parameters.
- OpenAPI documentation: generate the swagger.yaml file for the 3 most important endpoints.
- Security best practices: rate limiting, input validation, CORS and security headers.
Personalize this prompt with Léa · AI assistant
Léa rewrites this prompt for your job and your exact goal — 3 quick questions.
Why this prompt works
This prompt guides the AI through all the architectural decisions of a professional REST API. By specifying resources and constraints upfront, you get a coherent and realistic design rather than a generic example. Requesting a partial OpenAPI file is particularly valuable as it turns design decisions into a specification for frontend and backend teams to review and use. Including security aspects (rate limiting, CORS, headers) in the initial design rather than as an afterthought reflects Security by Design best practices, reducing the risk of vulnerabilities introduced through late additions.
Use Cases
Expected Output
A complete API specification with endpoints, authentication flow, error format, pagination strategy, and OpenAPI excerpt.
Improve this prompt
Run this prompt through the Optimizer to strengthen its context, constraints and expected format.
Improve this prompt with the OptimizerComments
Be the first to comment on this prompt.
Glossary Terms
📬 Get new prompts every week
Join our newsletter and never miss a prompt.
Go further
Improve this prompt with the Optimizer
Analyze the prompt, strengthen the context and get a more precise version.
Prompt Engineering
Cross-model principles for writing more reliable prompts.
AI prompts for web developers
Code review and debugging, keeping API keys and secrets out of the prompt.
Security, GDPR & Business Plans
ChatGPT Business, Claude Team, Gemini Workspace and Mistral Vibe compared from vendor sources: training, EU hosting and a GDPR checklist.
Similar Prompts
Task brief for Claude Code: frame a feature end to end
Brief template to delegate a complete feature to Claude Code: goal, starting point, constraints, definition of done, working rules and recap format.
Write a project's CLAUDE.md: the brief Claude Code reads at every session
Turns your project description into a dense CLAUDE.md: commands, structure, conventions, pitfalls, off-limits areas and situations where the agent must ask before acting.
Design a Secure Webhook API
Design a webhook API with event subscriptions, signed deliveries, retry limits, and a delivery log your support team can inspect.
Generate Storybook Stories for UI Components
Generate Storybook stories for a UI component, with visual variants, interactive controls, interaction tests, and MDX documentation.