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

Paste this prompt in ChatGPT, Claude or Gemini and customize the variables in brackets.

Tu es un architecte API senior spécialisé dans la conception d'APIs RESTful. Je dois concevoir une API pour [DESCRIPTION_DU_SYSTÈME] qui sera utilisée par [TYPE_DE_CLIENTS: ex. applications mobiles, partenaires tiers, frontend React].

Ressources principales à gérer :
[LISTER_LES_RESSOURCES: ex. Utilisateurs, Produits, Commandes, Paiements]

Contraintes techniques :

  • Backend : [EX: Node.js/Express, Python/FastAPI, Go]
  • Authentification : [EX: JWT, OAuth2, API Key]
  • Volume estimé : [EX: 10 000 requêtes/jour]
  • Versions à supporter : [EX: v1 uniquement, ou v1 + v2]

Conçois une API REST complète en couvrant :

  1. Structure des endpoints : liste tous les endpoints CRUD pour chaque ressource avec leur méthode HTTP, chemin, paramètres et codes de réponse.
  2. Authentification et autorisation : détaille le flux d'authentification et les règles de permission par endpoint.
  3. Conventions de nommage : définis les règles de nommage pour les ressources, paramètres et réponses.
  4. Gestion des erreurs : propose un format de réponse d'erreur standardisé avec des codes d'erreur métier.
  5. Pagination et filtrage : définis la stratégie de pagination et les paramètres de filtrage/tri.
  6. Documentation OpenAPI : génère le fichier swagger.yaml pour les 3 endpoints les plus importants.
  7. Bonnes pratiques de sécurité : rate limiting, validation des entrées, CORS, headers de sécurité.
100% found this useful

Personalize this prompt with Léa

Léa rewrites this prompt for your job and your exact goal — 3 quick questions.

Why this prompt works

<p>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.</p><p>Requesting a partial OpenAPI file is particularly valuable as it forces the concretization of conceptual decisions into an executable specification that frontend and backend teams can use immediately.</p><p>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.</p>

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

  • LéaAI

    Ajoutez dans la section "Contraintes techniques" le format des données (JSON, XML) et une durée de validité des tokens. Ça évitera des réponses trop génériques et vous obtiendrez des flux d'authentification plus précis, avec des politiques de rafraîchissement réutilisables.

📬 Get new prompts every week

Join our newsletter and never miss a prompt.

Go further

Similar Prompts

💻DeveloppementBeginnerAll AIs

Brand Comment Responses

Consistent and fast social media community management

0219
💻DeveloppementIntermediateClaude

Complete Code Review for Pull Requests

Get an exhaustive code review covering quality, performance, security, and maintainability for any language.

34561
💻DeveloppementAdvancedChatGPT

Master Advanced TypeScript Types

Strengthen your code's type safety with advanced generics, utility types, and discriminated unions.

39548
💻DeveloppementIntermediateAll AIs

Perplexity Prompt for Generating Python Code

Perplexity AI stands out from other AI assistants with its unique ability to combine real-time web search and code generation. When it comes to producing Python code, this advantage is significant: Perplexity can rely on the latest official documentation, current best practices, and up-to-date libraries to generate reliable and modern code. Unlike a classic LLM whose knowledge is frozen at a cutoff date, Perplexity verifies its sources in real time, drastically reducing the risk of obsolete code or deprecated functions. Whether you are a developer looking to speed up your workflow, a data scientist wanting to prototype quickly, or a beginner learning Python, a well-structured prompt turns Perplexity into a true development assistant. The key lies in the precision of your request: by specifying the technical context, constraints, and expected output format, you get production-ready code rather than a generic snippet. This guide offers optimized prompts to get the most out of Perplexity in your Python projects.

0204