ZAppwrite icon

ZAppwrite

Use Appwrite's API from inside N8N, updated by @ZachHandley

Overview

The node integrates with Appwrite's Document service to create documents within a specified database and collection. It allows users to define the document ID (either auto-generated unique or custom) and provide the content body as JSON. This operation is useful for automating data insertion into Appwrite databases, such as adding new records, logs, or structured data entries.

Practical examples:

  • Automatically creating user profiles in an Appwrite database when a new signup occurs.
  • Logging events or transactions by inserting documents into a collection.
  • Storing form submissions or API responses as documents for later retrieval.

Properties

Name Meaning
Database ID The identifier of the Appwrite database where the document will be created.
Collection ID The identifier of the collection within the database where the document will be stored.
Document ID The unique identifier for the document. Defaults to a generated unique ID but can be customized.
Body The JSON object representing the content of the document to create.

Output

The output is a JSON array containing the response from the Appwrite API after creating the document. This typically includes the newly created document's metadata and content fields as returned by Appwrite.

If the creation is successful, the output JSON will contain the full document object including its ID, timestamps, and any attributes set in the body.

Dependencies

  • Requires an active Appwrite project with API access.
  • Needs credentials configured in n8n that include:
    • Appwrite endpoint URL
    • Project ID
    • API key or authentication token with permissions to create documents.
  • Uses the official Appwrite Node.js SDK internally.

Troubleshooting

  • Common issues:

    • Invalid or missing Database ID or Collection ID will cause failures.
    • Providing an invalid JSON structure in the Body property may result in errors.
    • Using a duplicate Document ID (if manually set) might cause conflicts.
    • Insufficient permissions on the API key can lead to authorization errors.
  • Error messages:

    • "Resource not found" if the database or collection does not exist.
    • Authentication errors if credentials are incorrect or expired.
    • Validation errors if the document body does not conform to the collection schema.
  • Resolutions:

    • Verify that the Database ID and Collection ID are correct and exist in your Appwrite project.
    • Ensure the API key has write permissions for the target database and collection.
    • Validate the JSON body before sending.
    • Use the default unique ID generation unless a specific ID is required and guaranteed unique.

Links and References

Discussion