Appwrite icon

Appwrite

Interact with Appwrite API

Actions181

Document → Create

AI-generated

Overview

This node interacts with the Appwrite API to create a new document within a specified database and collection. It is useful for automating the creation of documents in Appwrite databases, such as adding new records or entries programmatically. For example, it can be used to add user data, product information, or any structured data as JSON into an Appwrite collection.

Use Case Examples

  1. Creating a new user profile document in a user database.
  2. Adding a new product entry to an inventory collection.

Properties

Name Meaning
Database ID The ID of the database where the document will be created.
Collection ID The ID of the collection within the database where the document will be created.
Document ID The ID of the document to create. Can be set to unique() to generate a unique ID automatically.
Data The JSON data representing the content of the document to be created.
Permissions An array of permission strings defining access control for the document.

Output

JSON

  • $id - The unique identifier of the created document.
  • $collectionId - The ID of the collection containing the document.
  • $databaseId - The ID of the database containing the collection.
  • $createdAt - Timestamp when the document was created.
  • $updatedAt - Timestamp when the document was last updated.
  • data - The JSON data stored in the document.
  • permissions - The permissions assigned to the document.

Dependencies

  • Appwrite API key credential for authentication

Troubleshooting

  • Ensure the databaseId and collectionId are correct and exist in your Appwrite project.
  • Verify that the API key credential has sufficient permissions to create documents.
  • Check the JSON format of the data property to avoid syntax errors.
  • If using unique() for documentId, ensure the function is supported and correctly generates unique IDs.

Links

Discussion