P
IntermediateAll AIs

Design a REST API following best practices

Guide the design of a complete and well-structured REST API, from endpoint definition to OpenAPI documentation, following industry standards.

Paste in your AI

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

Tu es un expert en conception d'APIs REST. Aide-moi à concevoir une API complète pour le besoin suivant.

**Ressource / Domaine métier :** [DOMAINE_METIER] (ex: gestion des commandes e-commerce)

**Utilisateurs de l'API :** [UTILISATEURS_API] (ex: application mobile, partenaires B2B)

**Authentification souhaitée :** [TYPE_AUTH] (JWT, OAuth2, API Key...)

Conçois l'API en couvrant :
1. Liste des endpoints avec verbes HTTP, URLs et descriptions
2. Conventions de nommage et structure des URLs
3. Schémas de requête et réponse (format JSON avec exemples)
4. Codes HTTP retournés par endpoint et leur signification
5. Gestion des erreurs (format standard, codes d'erreur métier)
6. Stratégie de versioning (v1, v2...)
7. Pagination, filtrage et tri pour les listes
8. Rate limiting recommandé
9. Exemple OpenAPI/Swagger pour 2 endpoints clés
10. Liste des pièges REST courants à éviter

Why this prompt works

The prompt covers all dimensions of a production-quality API. The request for concrete JSON examples avoids overly abstract responses. The inclusion of common pitfalls to avoid produces a quality checklist integrated into the deliverable.

Use Cases

Start a new backend projectStandardize a team's APIsPrepare documentation for API partners

Expected Output

Complete API specification with endpoint list, JSON schemas, error codes, OpenAPI example and list of anti-patterns to avoid.

Learn more

Check the full skill on Prompt Guide to master this technique from A to Z.

View on Prompt Guide