Automatic REST API Documentation Generator Agent
This agent analyzes your source code or API specifications to automatically generate complete and structured technical documentation. It produces endpoint descriptions, data schemas, request/response examples, and documented error handling. The result is ready to integrate into a developer portal or export in OpenAPI format.
For who
Backend developers, tech leads, and DevOps teams looking to quickly document their REST APIs without manually writing each endpoint.
Input
Code source de l'API (fichiers de routes, contrôleurs, modèles, middleware) ou spécification partielle des endpoints à documenter. Formats acceptés : JavaScript/TypeScript (Express, NestJS), Python (FastAPI, Django), PHP (Laravel), Java (Spring Boot), ou toute description textuelle des endpoints.
steps (4)
Source Code Analysis and Endpoint Extraction
promptScans source code to identify and inventory all API endpoints and their characteristics.
Description and Data Schema Generation
promptGenerates detailed descriptions and data schemas for each endpoint.
Request and Response Example Creation
promptCreates realistic copy-paste ready usage examples for each endpoint.
Final Documentation Compilation
promptAssembles all elements into polished documentation ready for publication.
Output
Documentation API complète incluant : description de chaque endpoint, schémas JSON Schema des requêtes et réponses, exemples cURL et multi-langages, gestion des erreurs, guide d'authentification et modèles de données. Format Markdown ou OpenAPI selon le choix utilisateur.
Example
Input
// routes/users.js (Express)
router.get('/api/v1/users', authMiddleware, async (req, res) => {
const { page = 1, limit = 20, role } = req.query;
const users = await User.find(role ? { role } : {}).skip((page-1)*limit).limit(limit);
const total = await User.countDocuments(role ? { role } : {});
res.json({ data: users, pagination: { page, limit, total } });
});
router.post('/api/v1/users', authMiddleware, adminOnly, async (req, res) => {
const { email, name, role } = req.body;
if (!email || !name) return res.status(400).json({ error: 'Email and name required' });
const user = await User.create({ email, name, role: role || 'user' });
res.status(201).json({ data: user });
});Output
## Users
### GET /api/v1/users
**Lists users** with pagination and optional role filtering.
- Auth: Bearer token required
- Query params: page (number, default: 1), limit (number, default: 20), role (string, optional)
- Response 200: { data: User[], pagination: { page, limit, total } }
```curl
curl -H 'Authorization: Bearer eyJhb...' 'https://api.example.com/api/v1/users?page=1&limit=20&role=admin'
```
### POST /api/v1/users
**Creates a new user.** Restricted to administrators.
- Auth: Bearer token required + admin role
- Body: { email (string, required), name (string, required), role (string, default: 'user') }
- Response 201: { data: User }
- Error 400: { error: 'Email and name required' }Customization
| Parameter | Description | Default |
|---|---|---|
| format_sortie | Format du document de documentation final généré par l'agent | Markdown |
| lang | Langue de rédaction de la documentation (français, anglais, etc.) | français |
| lang_sdk | Langage pour les exemples de code SDK côté client | JavaScript (fetch) |
Technical Notes
This agent works optimally with structured source code using popular frameworks (Express, NestJS, FastAPI, Django REST, Spring Boot, Laravel). For less common frameworks, provide comments or annotations in the code to improve endpoint detection.
The Markdown output format can be converted to OpenAPI 3.0 YAML by adding this instruction in the step 4 prompt. For very large APIs (50+ endpoints), it is recommended to split the code by module and run the agent multiple times, then merge the results.
Generated examples use realistic fictional data. Always verify validation constraints and error codes against your actual implementation before publishing the documentation.
Related Prompts
Churn Prediction
Proactively prevent churn
Non-Disclosure Agreement (NDA)
NDA
Create effective contextual reminders and alerts
Design a contextual reminders and alerts system that ensures follow-up on critical tasks without overloading your team with notifications.
Prompt Mistral to Synthesize a Meeting
Professional meetings generate a considerable amount of information that is often difficult to remember and structure afterwards. Whether it's a weekly team stand-up, a steering committee, or a creative brainstorming session, synthesizing a meeting is a time-consuming but essential exercise to ensure decision tracking and team coordination. Mistral, the French language model, excels at this task thanks to its nuanced understanding of French and its ability to prioritize information. By providing a transcription or raw meeting notes, Mistral can produce a structured report in seconds, complete with key points, decisions made, action items, and identified owners. This approach not only saves valuable time but also ensures no critical information is forgotten. Whether you are a project manager, executive assistant, or member of an agile team, using Mistral to synthesize your meetings will transform how you document and track your professional exchanges.