Generations API – POST /api/generate-multi-file-documentation
This endpoint enables batch generation of AI-powered markdown documentation for multiple source files in one request.
Authentication & Authorization
- 🎫 Guard:
auth:sanctum middleware
- 🔑 Header:
Authorization: Bearer <token>
Content-Type: application/json
Request
Endpoint Definition
| Method |
Path |
| POST |
/api/generate-multi-file-documentation |
Body Parameters
| Field |
Type |
Required |
Description |
files |
array |
yes |
Array of file objects (min 1, max 1000) |
*.filename |
string (max 255) |
yes |
Original file name |
*.source_code |
string |
yes |
Raw source code |
outputdocumentationtype |
string |
no |
e.g. General Documentation, API Documentation |
language |
string |
no |
Output language (default: English) |
additional_instructions |
string |
no |
Free-form instructions to customize the prompt |
name |
string (max 255) |
no |
Friendly name for this generation; defaults to comma-joined filenames |
Example Request
{
"title": "Generate Multi-File Documentation",
"description": "Create combined markdown docs for multiple source files.",
"method": "POST",
"baseUrl": "https://app.docuwriter.ai/api",
"endpoint": "/generate-multi-file-documentation",
"headers": [
{
"key": "Authorization",
"value": "Bearer <token>",
"required": true
},
{
"key": "Content-Type",
"value": "application/json",
"required": true
}
],
"queryParams": [],
"pathParams": [],
"bodyType": "json",
"requestBody": "{\n \"files\": [\n { \"filename\": \"User.php\", \"source_code\": \"<?php ... ?>\" },\n { \"filename\": \"AuthService.js\", \"source_code\": \"function auth() { ... }\" }\n ],\n \"output_documentation_type\": \"API Documentation\",\n \"language\": \"English\",\n \"additional_instructions\": \"Highlight security checks\",\n \"name\": \"AuthModuleDocs\"\n}",
"formData": [],
"rawBody": "",
"responses": {
"200": {
"description": "Success",
"body": "{\"message\": \"Success\"}"
}
}
}
Response Schema
Success (200 OK)
| Field |
Type |
Description |
success |
boolean |
Always true |
data.generation |
string |
Generated markdown documentation |
data.content |
string |
Alias for generated docs (for compatibility) |
data.markdown |
string |
Alias for generated docs in markdown format |
message |
string |
"Multi-file documentation generated successfully" |
{
"success": true,
"data": {
"generation": "# **User.php**\n…",
"content": "# **User.php**\n…",
"markdown": "# **User.php**\n…"
},
"message": "Multi-file documentation generated successfully"
}
Errors
| HTTP Code |
Condition |
Response Body |
| 400 |
Invalid input (e.g., token budget exceeded) |
{ "success": false, "message": "The provided code is too large for processing. Please reduce ..."} |
| 403 |
No credits / Viewer role |
{ "success": false, "message": "You have no remaining credits. Please upgrade your plan."} or { "success":false,"message":"Users with the Viewer role cannot generate new documentation."} |
| 500 |
Response parsing / Unexpected exceptions |
{ "success": false, "message": "Error generating documentation. Please try again." } |
| 500 |
No message content in AI response |
{ "success": false, "message": "No message content found in the API response." } |