The Databases service allows you to create structured collections of documents, query and filter lists of documents, and manage an advanced set of read and write access permissions.
All data returned by the Databases service are represented as structured JSON documents.
The Databases service can contain multiple databases, each database can contain multiple collections. A collection is a group of similarly structured documents. The accepted structure of documents is defined by collection attributes. The collection attributes help you ensure all your user-submitted data is validated and stored according to the collection structure.
Using Appwrite permissions architecture, you can assign read or write access to each collection or document in your project for either a specific user, team, user role, or even grant it with public access (any
). You can learn more about how Appwrite handles permissions and access control.
https://cloud.appwrite.io/v1
List Databases
Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results.
Request
queries Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name
search Search term to filter your list results. Max length: 256 chars.
Response
200
GET /databases
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const databases = new sdk.Databases(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = databases.list();
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Create Database
Create a new Database.
Request
databaseId requiredUnique Id. Choose a custom ID or generate a random ID with
ID.unique()
. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.name requiredCollection name. Max length: 128 chars.
Response
201
POST /databases
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const databases = new sdk.Databases(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = databases.create('[DATABASE_ID]', '[NAME]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Get Database
Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata.
Request
databaseId requiredDatabase ID.
Response
200
GET /databases/{databaseId}
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const databases = new sdk.Databases(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = databases.get('[DATABASE_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Update Database
Update a database by its unique ID.
Request
databaseId requiredDatabase ID.
name requiredDatabase name. Max length: 128 chars.
Response
200
PUT /databases/{databaseId}
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const databases = new sdk.Databases(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = databases.update('[DATABASE_ID]', '[NAME]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Delete Database
Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database.
Request
databaseId requiredDatabase ID.
Response
204
DELETE /databases/{databaseId}
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const databases = new sdk.Databases(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = databases.delete('[DATABASE_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
List Collections
Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results.
Request
databaseId requiredDatabase ID.
queries Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, documentSecurity
search Search term to filter your list results. Max length: 256 chars.
Response
200
GET /databases/{databaseId}/collections
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const databases = new sdk.Databases(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = databases.listCollections('[DATABASE_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Create Collection
Create a new Collection. Before using this route, you should create a new database resource using either a server integration API or directly from your database console.
Request
databaseId requiredDatabase ID.
collectionId requiredUnique Id. Choose a custom ID or generate a random ID with
ID.unique()
. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.name requiredCollection name. Max length: 128 chars.
permissions An array of permissions strings. By default, no user is granted with any permissions. Learn more about permissions.
documentSecurity Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. Learn more about permissions.
Response
201
POST /databases/{databaseId}/collections
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const databases = new sdk.Databases(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = databases.createCollection('[DATABASE_ID]', '[COLLECTION_ID]', '[NAME]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Get Collection
Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata.
Request
databaseId requiredDatabase ID.
collectionId requiredCollection ID.
Response
200
GET /databases/{databaseId}/collections/{collectionId}
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const databases = new sdk.Databases(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = databases.getCollection('[DATABASE_ID]', '[COLLECTION_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Update Collection
Update a collection by its unique ID.
Request
databaseId requiredDatabase ID.
collectionId requiredCollection ID.
name requiredCollection name. Max length: 128 chars.
permissions An array of permission strings. By default, the current permissions are inherited. Learn more about permissions.
documentSecurity Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. Learn more about permissions.
enabled Is collection enabled?
Response
200
PUT /databases/{databaseId}/collections/{collectionId}
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const databases = new sdk.Databases(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = databases.updateCollection('[DATABASE_ID]', '[COLLECTION_ID]', '[NAME]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Delete Collection
Delete a collection by its unique ID. Only users with write permissions have access to delete this resource.
Request
databaseId requiredDatabase ID.
collectionId requiredCollection ID.
Response
204
DELETE /databases/{databaseId}/collections/{collectionId}
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const databases = new sdk.Databases(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = databases.deleteCollection('[DATABASE_ID]', '[COLLECTION_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
List Attributes
Request
databaseId requiredDatabase ID.
collectionId requiredCollection ID. You can create a new collection using the Database service server integration.
Response
200
GET /databases/{databaseId}/collections/{collectionId}/attributes
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const databases = new sdk.Databases(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = databases.listAttributes('[DATABASE_ID]', '[COLLECTION_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Create Boolean Attribute
Create a boolean attribute.
Request
databaseId requiredDatabase ID.
collectionId requiredCollection ID. You can create a new collection using the Database service server integration.
key requiredAttribute Key.
required requiredIs attribute required?
default Default value for attribute when not provided. Cannot be set when attribute is required.
array Is attribute an array?
Response
202
POST /databases/{databaseId}/collections/{collectionId}/attributes/boolean
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const databases = new sdk.Databases(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = databases.createBooleanAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false);
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Create DateTime Attribute
Request
databaseId requiredDatabase ID.
collectionId requiredCollection ID. You can create a new collection using the Database service server integration.
key requiredAttribute Key.
required requiredIs attribute required?
default Default value for the attribute in ISO 8601 format. Cannot be set when attribute is required.
array Is attribute an array?
Response
POST /databases/{databaseId}/collections/{collectionId}/attributes/datetime
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const databases = new sdk.Databases(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = databases.createDatetimeAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false);
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Create Email Attribute
Create an email attribute.
Request
databaseId requiredDatabase ID.
collectionId requiredCollection ID. You can create a new collection using the Database service server integration.
key requiredAttribute Key.
required requiredIs attribute required?
default Default value for attribute when not provided. Cannot be set when attribute is required.
array Is attribute an array?
Response
202
POST /databases/{databaseId}/collections/{collectionId}/attributes/email
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const databases = new sdk.Databases(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = databases.createEmailAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false);
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Create Enum Attribute
Request
databaseId requiredDatabase ID.
collectionId requiredCollection ID. You can create a new collection using the Database service server integration.
key requiredAttribute Key.
elements requiredArray of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 4096 characters long.
required requiredIs attribute required?
default Default value for attribute when not provided. Cannot be set when attribute is required.
array Is attribute an array?
Response
202
POST /databases/{databaseId}/collections/{collectionId}/attributes/enum
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const databases = new sdk.Databases(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = databases.createEnumAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', [], false);
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Create Float Attribute
Create a float attribute. Optionally, minimum and maximum values can be provided.
Request
databaseId requiredDatabase ID.
collectionId requiredCollection ID. You can create a new collection using the Database service server integration.
key requiredAttribute Key.
required requiredIs attribute required?
min Minimum value to enforce on new documents
max Maximum value to enforce on new documents
default Default value for attribute when not provided. Cannot be set when attribute is required.
array Is attribute an array?
Response
202
POST /databases/{databaseId}/collections/{collectionId}/attributes/float
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const databases = new sdk.Databases(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = databases.createFloatAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false);
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Create Integer Attribute
Create an integer attribute. Optionally, minimum and maximum values can be provided.
Request
databaseId requiredDatabase ID.
collectionId requiredCollection ID. You can create a new collection using the Database service server integration.
key requiredAttribute Key.
required requiredIs attribute required?
min Minimum value to enforce on new documents
max Maximum value to enforce on new documents
default Default value for attribute when not provided. Cannot be set when attribute is required.
array Is attribute an array?
Response
202
POST /databases/{databaseId}/collections/{collectionId}/attributes/integer
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const databases = new sdk.Databases(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = databases.createIntegerAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false);
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Create IP Address Attribute
Create IP address attribute.
Request
databaseId requiredDatabase ID.
collectionId requiredCollection ID. You can create a new collection using the Database service server integration.
key requiredAttribute Key.
required requiredIs attribute required?
default Default value for attribute when not provided. Cannot be set when attribute is required.
array Is attribute an array?
Response
202
POST /databases/{databaseId}/collections/{collectionId}/attributes/ip
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const databases = new sdk.Databases(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = databases.createIpAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false);
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Create String Attribute
Create a string attribute.
Request
databaseId requiredDatabase ID.
collectionId requiredCollection ID. You can create a new collection using the Database service server integration.
key requiredAttribute Key.
size requiredAttribute size for text attributes, in number of characters.
required requiredIs attribute required?
default Default value for attribute when not provided. Cannot be set when attribute is required.
array Is attribute an array?
Response
202
POST /databases/{databaseId}/collections/{collectionId}/attributes/string
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const databases = new sdk.Databases(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = databases.createStringAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', 1, false);
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Create URL Attribute
Create a URL attribute.
Request
databaseId requiredDatabase ID.
collectionId requiredCollection ID. You can create a new collection using the Database service server integration.
key requiredAttribute Key.
required requiredIs attribute required?
default Default value for attribute when not provided. Cannot be set when attribute is required.
array Is attribute an array?
Response
202
POST /databases/{databaseId}/collections/{collectionId}/attributes/url
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const databases = new sdk.Databases(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = databases.createUrlAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false);
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Get Attribute
Request
databaseId requiredDatabase ID.
collectionId requiredCollection ID. You can create a new collection using the Database service server integration.
key requiredAttribute Key.
GET /databases/{databaseId}/collections/{collectionId}/attributes/{key}
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const databases = new sdk.Databases(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = databases.getAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Delete Attribute
Request
databaseId requiredDatabase ID.
collectionId requiredCollection ID. You can create a new collection using the Database service server integration.
key requiredAttribute Key.
Response
204
DELETE /databases/{databaseId}/collections/{collectionId}/attributes/{key}
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const databases = new sdk.Databases(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = databases.deleteAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
List Documents
Get a list of all the user's documents in a given collection. You can use the query params to filter your results.
Request
databaseId requiredDatabase ID.
collectionId requiredCollection ID. You can create a new collection using the Database service server integration.
queries Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long.
Response
200
GET /databases/{databaseId}/collections/{collectionId}/documents
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const databases = new sdk.Databases(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = databases.listDocuments('[DATABASE_ID]', '[COLLECTION_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Create Document
Create a new Document. Before using this route, you should create a new collection resource using either a server integration API or directly from your database console.
Request
databaseId requiredDatabase ID.
collectionId requiredCollection ID. You can create a new collection using the Database service server integration. Make sure to define attributes before creating documents.
documentId requiredDocument ID. Choose a custom ID or generate a random ID with
ID.unique()
. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.data requiredDocument data as JSON object.
permissions An array of permissions strings. By default, only the current user is granted all permissions. Learn more about permissions.
Response
201
Rate limits
This endpoint is not limited when using Server SDKs with API keys. If you are using SSR with
setSession
, these rate limits will still apply. Learn more about SSR rate limits.The limit is applied for each unique limit key.
Time frameAttemptsKey1 minutes 120 requests IP + METHOD + URL + USER ID
POST /databases/{databaseId}/collections/{collectionId}/documents
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const databases = new sdk.Databases(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = databases.createDocument('[DATABASE_ID]', '[COLLECTION_ID]', '[DOCUMENT_ID]', {});
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Get Document
Get a document by its unique ID. This endpoint response returns a JSON object with the document data.
Request
databaseId requiredDatabase ID.
collectionId requiredCollection ID. You can create a new collection using the Database service server integration.
documentId requiredDocument ID.
Response
200
GET /databases/{databaseId}/collections/{collectionId}/documents/{documentId}
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const databases = new sdk.Databases(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = databases.getDocument('[DATABASE_ID]', '[COLLECTION_ID]', '[DOCUMENT_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Update Document
Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.
Request
databaseId requiredDatabase ID.
collectionId requiredCollection ID.
documentId requiredDocument ID.
data Document data as JSON object. Include only attribute and value pairs to be updated.
permissions An array of permissions strings. By default, the current permissions are inherited. Learn more about permissions.
Response
200
Rate limits
This endpoint is not limited when using Server SDKs with API keys. If you are using SSR with
setSession
, these rate limits will still apply. Learn more about SSR rate limits.The limit is applied for each unique limit key.
Time frameAttemptsKey1 minutes 120 requests IP + METHOD + URL + USER ID
PATCH /databases/{databaseId}/collections/{collectionId}/documents/{documentId}
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const databases = new sdk.Databases(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = databases.updateDocument('[DATABASE_ID]', '[COLLECTION_ID]', '[DOCUMENT_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Delete Document
Delete a document by its unique ID.
Request
databaseId requiredDatabase ID.
collectionId requiredCollection ID. You can create a new collection using the Database service server integration.
documentId requiredDocument ID.
Response
204
Rate limits
This endpoint is not limited when using Server SDKs with API keys. If you are using SSR with
setSession
, these rate limits will still apply. Learn more about SSR rate limits.The limit is applied for each unique limit key.
Time frameAttemptsKey1 minutes 60 requests IP + METHOD + URL + USER ID
DELETE /databases/{databaseId}/collections/{collectionId}/documents/{documentId}
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const databases = new sdk.Databases(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = databases.deleteDocument('[DATABASE_ID]', '[COLLECTION_ID]', '[DOCUMENT_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
List Indexes
Request
databaseId requiredDatabase ID.
collectionId requiredCollection ID. You can create a new collection using the Database service server integration.
Response
200
GET /databases/{databaseId}/collections/{collectionId}/indexes
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const databases = new sdk.Databases(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = databases.listIndexes('[DATABASE_ID]', '[COLLECTION_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Create Index
Request
databaseId requiredDatabase ID.
collectionId requiredCollection ID. You can create a new collection using the Database service server integration.
key requiredIndex Key.
type requiredIndex type.
attributes requiredArray of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long.
orders Array of index orders. Maximum of 100 orders are allowed.
Response
202
POST /databases/{databaseId}/collections/{collectionId}/indexes
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const databases = new sdk.Databases(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = databases.createIndex('[DATABASE_ID]', '[COLLECTION_ID]', '', 'key', []);
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Get Index
Request
databaseId requiredDatabase ID.
collectionId requiredCollection ID. You can create a new collection using the Database service server integration.
key requiredIndex Key.
Response
200
GET /databases/{databaseId}/collections/{collectionId}/indexes/{key}
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const databases = new sdk.Databases(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = databases.getIndex('[DATABASE_ID]', '[COLLECTION_ID]', '');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Delete Index
Request
databaseId requiredDatabase ID.
collectionId requiredCollection ID. You can create a new collection using the Database service server integration.
key requiredIndex Key.
Response
204
DELETE /databases/{databaseId}/collections/{collectionId}/indexes/{key}
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const databases = new sdk.Databases(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = databases.deleteIndex('[DATABASE_ID]', '[COLLECTION_ID]', '');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});