Skip to content
post

Create Document

Endpoint

posthttps://<REGION>.cloud.appwrite.io...ollections/{collectionId}/documents

Description

Required scopes

documents.write

Authentication

Initialize the Appwrite client with setProject() and ensure the user is signed in. The SDK sends the session header automatically after login.

Path

string
Required
string
Required

Body

string
Required
object
Required
array
array
Status
Content type
201
application/json

Document

Name
Type
Description
string
string
integer
integer
arrayof string
arrayof string
JavaScript
import { Client, Databases } from "appwrite";
const client = new Client();
const databases = new Databases(client, '[DATABASE_ID]');
client
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
const promise = databases.createDocument('[COLLECTION_ID]', '[DOCUMENT_ID]', {});
promise.then(function (response) {
console.log(response); // Success
}, function (error) {
console.log(error); // Failure
});