Overview
The Appwrite - Documents: Create node allows you to create a new document in a specified collection within an Appwrite database. This is useful for automating the process of adding structured data (such as user profiles, orders, or any custom records) into your Appwrite backend from n8n workflows.
Common scenarios:
- Automatically storing form submissions as documents.
- Logging events or transactions into a database.
- Creating records in response to triggers from other services.
Example:
When a new lead is captured via a web form, this node can be used to create a corresponding document in your Appwrite "Leads" collection.
Properties
| Name | Type | Meaning |
|---|---|---|
| Database ID | String | The unique identifier of the Appwrite database where the document will be created. |
| Collection ID | String | The unique identifier of the collection within the database where the document will be stored. |
| Document ID | String | The unique identifier for the new document. You can use unique() to auto-generate an ID. |
| Body | JSON | The content of the document to be created, provided as a JSON object with attribute-value pairs. |
| Options | Object | Additional options for document creation (not directly used in "Create", but present for compatibility). |
Output
The node outputs the JSON response returned by the Appwrite API after creating the document. This typically includes:
{
"$id": "string",
"$collectionId": "string",
"$databaseId": "string",
"attributeName1": "attribute-value1",
"attributeName2": "attribute-value2",
// ...other attributes as defined in your collection schema
}
$id: The ID of the newly created document.$collectionId: The collection ID where the document was created.$databaseId: The database ID.- Other fields: All attributes provided in the "Body" property and any default fields defined in your Appwrite collection.
Dependencies
- External Service: Requires access to an Appwrite instance.
- API Credentials: Needs an Appwrite API Key and Project ID configured in n8n credentials under
appwriteApi. - Environment Variables: None required by the node itself, but your Appwrite instance must be accessible from n8n.
Troubleshooting
Common Issues:
Invalid Credentials: If the API Key or Project ID is incorrect, authentication will fail.
- Error Message:
Auth settings are not valid: ... - Resolution: Double-check your Appwrite credentials in n8n.
- Error Message:
Missing Required Fields: If any of Database ID, Collection ID, Document ID, or Body are missing or invalid, the request will fail.
- Error Message: Typically a 400 error from Appwrite indicating which field is missing or invalid.
- Resolution: Ensure all required properties are filled and correctly formatted.
Document ID Conflict: If you provide a Document ID that already exists, Appwrite may return a conflict error.
- Resolution: Use
unique()or ensure the Document ID is not already in use.
- Resolution: Use
Schema Mismatch: If the Body does not match the expected schema of the collection, the API will reject the request.
- Resolution: Verify the structure and types of the attributes in the Body against your Appwrite collection schema.