Configuration and Credentials
This section explains how to configure and manage the DocuWriter.ai API credentials (docuWriterApi) in n8n. Both the DocuWriter.ai action node and the DocuWriter.ai Trigger node rely on these credentials to authenticate and interact with the DocuWriter.ai service.
DocuWriter.ai API Credential Type
The DocuWriterApi credential defines the necessary fields and authentication flow for all DocuWriter.ai nodes.
| 🔑 Field | Type | Required | Default | Description |
|---|---|---|---|---|
| API Token | string (password) | Yes | (none) | Your DocuWriter.ai API token. Get it from your account settings. |
| Base URL | string | No | https://app.docuwriter.ai |
Base URL for the DocuWriter.ai API. |
🔗 Documentation URL: https://docs.docuwriter.ai
Authentication Mechanism
- Uses generic authentication to attach headers on every request.
- Automatically adds:
Authorization: Bearer <apiToken>Content-Type: application/jsonAccept: application/json
authenticate: {
type: 'generic',
properties: {
headers: {
Authorization: '=Bearer {{$credentials.apiToken}}',
'Content-Type': 'application/json',
Accept: 'application/json',
},
},
}
Credential Testing
To verify credentials, n8n issues a test request:
test: {
request: {
baseURL: '={{$credentials.baseUrl}}/api',
url: '/user',
method: 'POST',
},
}
On success, you’ll receive user profile information from DocuWriter.ai.
Using docuWriterApi in Nodes
Both nodes declare docuWriterApi as a required credential. At runtime, they:
- Retrieve credentials via
this.getCredentials('docuWriterApi'). - Extract
baseUrland combine it with API paths. - Delegate HTTP calls to n8n’s
requestWithAuthenticationhelper, which injects headers and handles errors.
1. DocuWriter.ai Action Node
-
Type:
DocuWriter(n8n-nodes-docuwriter-ai.docuWriter) -
Credential Declaration:
credentials: [ { name: 'docuWriterApi', required: true, }, ],(inside
nodes/DocuWriter/DocuWriter.node.ts) -
Runtime Snippet:
// Get credentials to construct base URL const credentials = await this.getCredentials('docuWriterApi'); const baseUrl = credentials.baseUrl as string; // Example: Generate code documentation const responseData = await this.helpers.requestWithAuthentication.call( this, 'docuWriterApi', { method: 'POST', url: `${baseUrl}/api/generate-code-documentation`, body: { source_code: sourceCode, filename, output_language: outputLanguage, documentation_type: documentationType, }, json: true, }, ); -
Purpose: Executes various operations (
codeDocumentation,codeTests,codeComments,umlDiagram, etc.) by calling the corresponding DocuWriter.ai REST endpoints.
2. DocuWriter.ai Trigger Node
-
Type:
DocuWriterTrigger(n8n-nodes-docuwriter-ai.docuWriterTrigger) -
Credential Declaration:
credentials: [ { name: 'docuWriterApi', required: true, }, ],(inside
nodes/DocuWriterTrigger/DocuWriterTrigger.node.ts) -
Behavior:
- Listens for webhook events (e.g.,
generation.created,generation.updated). - Uses the same credential flow to validate incoming requests or fetch additional data.
- Listens for webhook events (e.g.,
Runtime Flow
sequenceDiagram
participant Node as n8n Node
participant CredStore as n8n Credential Store
participant DW as DocuWriter.ai API
Node->>CredStore: getCredentials('docuWriterApi')
CredStore-->>Node: { apiToken, baseUrl }
Node->>DW: POST {baseUrl}/api/... with headers:
Note right of Node: Authorization: Bearer <apiToken>
DW-->>Node: { data }
Node-->>n8n: return execution data
This flow ensures that all requests are secure, centralized, and consistent across both action and trigger nodes.
With these settings, you’re ready to connect n8n workflows to DocuWriter.ai, securely generating documentation, tests, diagrams, and more—powered by your personal API token and customizable base URL.
Updated