P
💻DeveloppementIntermediateAll AIs

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

Adapt this prompt

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:

  1. Endpoint structure: list all CRUD endpoints for each resource, with HTTP method, path, parameters and response codes.
  2. Authentication and authorization: detail the authentication flow and permission rules for each endpoint.
  3. Naming conventions: define naming rules for resources, parameters and responses.
  4. Error handling: propose a standardized error response format with business error codes.
  5. Pagination and filtering: define the pagination strategy and filtering/sorting parameters.
  6. OpenAPI documentation: generate the swagger.yaml file for the 3 most important endpoints.
  7. 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

New API designExisting API standardizationDocumentation for frontend/backend teams

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 Optimizer

Comments

Be the first to comment on this prompt.

📬 Get new prompts every week

Join our newsletter and never miss a prompt.

Go further

Similar Prompts

💻DeveloppementIntermediateClaude

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.

1681
💻DeveloppementIntermediateClaude

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.

640
💻DeveloppementAdvancedAll AIs

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.

411
💻DeveloppementIntermediateAll AIs

Generate Storybook Stories for UI Components

Generate Storybook stories for a UI component, with visual variants, interactive controls, interaction tests, and MDX documentation.

474