Nodes and API Operations (Reference) – Action node: DocuWriter.ai
This section details the DocuWriter.ai action node’s resources and operations. Each operation invokes a corresponding DocuWriter.ai REST API endpoint. Requests include authentication via the docuWriterApi credential and leverage requestWithAuthentication('docuWriterApi') under the hood .
🎯 Resource Summary
| Resource | Operation | Description |
|---|---|---|
| Code Documentation | generate | Auto-generate technical documentation from source code |
| Code Tests | generate | Produce unit/integration tests for source code |
| Code Comments | generate | Insert inline comments into source code |
| UML Diagram | generate | Create UML diagrams (class, sequence, etc.) |
| Generations | get, getAll | Retrieve metadata for generations |
Code Documentation · generate
Generate comprehensive documentation for provided source code.
{
"title": "Generate Code Documentation",
"description": "Generate technical documentation from source code.",
"method": "POST",
"baseUrl": "={{$credentials.baseUrl}}",
"endpoint": "/api/generate-code-documentation",
"headers": [
{ "key": "Authorization", "value": "Bearer <apiToken>", "required": true },
{ "key": "Content-Type", "value": "application/json", "required": true },
{ "key": "Accept", "value": "application/json", "required": true }
],
"bodyType": "json",
"requestBody": "{\n \"source_code\": \"console.log('Hello')\",\n \"filename\": \"example.js\",\n \"output_language\": \"English\",\n \"documentation_type\": \"Technical Documentation\"\n}",
"responses": {
"200": {
"description": "Success",
"body": "{\n \"data\": {\"generated\": \"# Example.js Documentation\\n...\"},\n \"generation_id\": \"abc123\",\n \"created_at\": \"2025-09-11T12:00:00Z\"\n}"
},
"4XX": {
"description": "Client Error",
"body": "{ \"error\": { \"message\": \"Invalid input\" } }"
}
}
}
Code Tests · generate
Produce test cases for the given code.
{
"title": "Generate Code Tests",
"description": "Auto-generate test cases using a specified framework and type.",
"method": "POST",
"baseUrl": "={{$credentials.baseUrl}}",
"endpoint": "/api/generate-code-tests",
"headers": [
{ "key": "Authorization", "value": "Bearer <apiToken>", "required": true },
{ "key": "Content-Type", "value": "application/json", "required": true },
{ "key": "Accept", "value": "application/json", "required": true }
],
"bodyType": "json",
"requestBody": "{\n \"source_code\": \"function sum(a,b){return a+b;}\",\n \"filename\": \"math.js\",\n \"test_framework\": \"jest\",\n \"test_type\": \"unit\"\n}",
"responses": {
"200": {
"description": "Success",
"body": "{\n \"data\": {\"tests\": \"describe('sum', ... )\"},\n \"generation_id\": \"def456\"\n}"
}
}
}
Code Comments · generate
Insert clear, inline comments explaining code logic.
{
"title": "Generate Code Comments",
"description": "Add inline comments to clarify code functions and parameters.",
"method": "POST",
"baseUrl": "={{$credentials.baseUrl}}",
"endpoint": "/api/generate-code-comments",
"headers": [
{ "key": "Authorization", "value": "Bearer <apiToken>", "required": true },
{ "key": "Content-Type", "value": "application/json", "required": true }
],
"bodyType": "json",
"requestBody": "{\n \"source_code\": \"function multiply(x,y){return x*y;}\",\n \"filename\": \"math.js\"\n}",
"responses": {
"200": {
"description": "Success",
"body": "{\n \"data\": {\"commented_code\": \"// Multiply two numbers\\nfunction multiply(x,y){...}\"},\n \"generation_id\": \"ghi789\"\n}"
}
}
}
UML Diagram · generate
Produce UML (e.g., class, sequence) from source code.
{
"title": "Generate UML Diagram",
"description": "Create UML diagrams for provided source code.",
"method": "POST",
"baseUrl": "={{$credentials.baseUrl}}",
"endpoint": "/api/generate-uml-diagram",
"headers": [
{ "key": "Authorization", "value": "Bearer <apiToken>", "required": true },
{ "key": "Content-Type", "value": "application/json", "required": true }
],
"bodyType": "json",
"requestBody": "{\n \"source_code\": \"class User { constructor(name){this.name=name;} }\",\n \"filename\": \"user.js\",\n \"diagram_type\": \"class\"\n}",
"responses": {
"200": {
"description": "Success",
"body": "{\n \"data\": {\"diagram\": \"classDiagram\\n class User { ... }\"},\n \"generation_id\": \"jkl012\"\n}"
}
}
}
Generations · get
Fetch details of a single generation by ID.
{
"title": "Get Generation Details",
"description": "Retrieve metadata and results for a specific generation.",
"method": "GET",
"baseUrl": "={{$credentials.baseUrl}}",
"endpoint": "/api/generations/{generationId}",
"pathParams": [
{ "key": "generationId", "value": "Generation ID", "required": true }
],
"headers": [
{ "key": "Authorization", "value": "Bearer <apiToken>", "required": true }
],
"bodyType": "none",
"responses": {
"200": {
"description": "Success",
"body": "{\n \"data\": {\"id\":\"abc123\",\"generated\":\"...\",\"created_at\":\"...\"}\n}"
}
}
}
Generations · getAll
List recent generations with optional filtering.
{
"title": "List Generations",
"description": "Retrieve a list of generations, optionally filtered by type.",
"method": "GET",
"baseUrl": "={{$credentials.baseUrl}}",
"endpoint": "/api/generations",
"headers": [
{ "key": "Authorization", "value": "Bearer <apiToken>", "required": true }
],
"queryParams": [
{ "key": "limit", "value": "Number of items (1–100)", "required": false },
{ "key": "type_filter", "value": "Filter by generation type", "required": false }
],
"bodyType": "none",
"responses": {
"200": {
"description": "Success",
"body": "{\n \"data\": [ {\"id\":\"abc123\",\"type\":\"Documentation\"}, {\"id\":\"def456\",\"type\":\"Tests\"} ]\n}"
}
}
}
Usage Notes
- All endpoints require the DocuWriter.ai API credential, configured with an API token and base URL.
- Use the Action node within n8n workflows to integrate seamlessly with DocuWriter.ai’s powerful code-generation capabilities.
- Customize parameters (e.g.,
diagram_type,documentation_type) to suit your specific requirements.
This reference enables precise integration and empowers your workflows to automate documentation, testing, and architectural visualization at scale.
Updated