Docs

Databases API


Server integration with  

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.

Create Database

POST/v1/databases

Create a new Database.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "databases.write" scope.

HTTP Request

Name Type Description
databaseId required string

Unique Id. Choose your own unique ID or pass the string ID.unique() to auto generate it. 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 required string

Collection name. Max length: 128 chars.

HTTP Response

Status Code Content Type Payload
201  Created application/json Database Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/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);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = databases.create('[DATABASE_ID]', '[NAME]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Databases;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $databases = new Databases($client);
    
    $result = $databases->create('[DATABASE_ID]', '[NAME]');
  • from appwrite.client import Client
    from appwrite.services.databases import Databases
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    databases = Databases(client)
    
    result = databases.create('[DATABASE_ID]', '[NAME]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    databases = Databases.new(client)
    
    response = databases.create(database_id: '[DATABASE_ID]', name: '[NAME]')
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Databases databases = Databases(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = databases.create(
        databaseId: '[DATABASE_ID]',
        name: '[NAME]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Databases
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val databases = Databases(client)
    
    val response = databases.create(
        databaseId = "[DATABASE_ID]",
        name = "[NAME]"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Databases;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Databases databases = new Databases(client);
    
    databases.create(
        "[DATABASE_ID]",
        "[NAME]"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let databases = Databases(client)
    
    let database = try await databases.create(
        databaseId: "[DATABASE_ID]",
        name: "[NAME]"
    )
    
    

List Databases

GET/v1/databases

Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "databases.read" scope.

HTTP Request

Name Type Description
queries optional array

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 optional string

Search term to filter your list results. Max length: 256 chars.

HTTP Response

Status Code Content Type Payload
200  OK application/json Databases List Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/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);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = databases.list();
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Databases;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $databases = new Databases($client);
    
    $result = $databases->list();
  • from appwrite.client import Client
    from appwrite.services.databases import Databases
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    databases = Databases(client)
    
    result = databases.list()
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    databases = Databases.new(client)
    
    response = databases.list()
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Databases databases = Databases(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = databases.list(
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Databases
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val databases = Databases(client)
    
    val response = databases.list(
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Databases;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Databases databases = new Databases(client);
    
    databases.list(
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let databases = Databases(client)
    
    let databaseList = try await databases.list()
    
    

Get Database

GET/v1/databases/{databaseId}

Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "databases.read" scope.

HTTP Request

Name Type Description
databaseId required string

Database ID.

HTTP Response

Status Code Content Type Payload
200  OK application/json Database Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/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);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = databases.get('[DATABASE_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Databases;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $databases = new Databases($client);
    
    $result = $databases->get('[DATABASE_ID]');
  • from appwrite.client import Client
    from appwrite.services.databases import Databases
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    databases = Databases(client)
    
    result = databases.get('[DATABASE_ID]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    databases = Databases.new(client)
    
    response = databases.get(database_id: '[DATABASE_ID]')
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Databases databases = Databases(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = databases.get(
        databaseId: '[DATABASE_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Databases
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val databases = Databases(client)
    
    val response = databases.get(
        databaseId = "[DATABASE_ID]"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Databases;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Databases databases = new Databases(client);
    
    databases.get(
        "[DATABASE_ID]"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let databases = Databases(client)
    
    let database = try await databases.get(
        databaseId: "[DATABASE_ID]"
    )
    
    

Update Database

PUT/v1/databases/{databaseId}

Update a database by its unique ID.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "databases.write" scope.

HTTP Request

Name Type Description
databaseId required string

Database ID.

name required string

Collection name. Max length: 128 chars.

HTTP Response

Status Code Content Type Payload
200  OK application/json Database Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/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);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = databases.update('[DATABASE_ID]', '[NAME]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Databases;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $databases = new Databases($client);
    
    $result = $databases->update('[DATABASE_ID]', '[NAME]');
  • from appwrite.client import Client
    from appwrite.services.databases import Databases
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    databases = Databases(client)
    
    result = databases.update('[DATABASE_ID]', '[NAME]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    databases = Databases.new(client)
    
    response = databases.update(database_id: '[DATABASE_ID]', name: '[NAME]')
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Databases databases = Databases(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = databases.update(
        databaseId: '[DATABASE_ID]',
        name: '[NAME]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Databases
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val databases = Databases(client)
    
    val response = databases.update(
        databaseId = "[DATABASE_ID]",
        name = "[NAME]"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Databases;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Databases databases = new Databases(client);
    
    databases.update(
        "[DATABASE_ID]",
        "[NAME]"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let databases = Databases(client)
    
    let database = try await databases.update(
        databaseId: "[DATABASE_ID]",
        name: "[NAME]"
    )
    
    

Delete Database

DELETE/v1/databases/{databaseId}

Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "databases.write" scope.

HTTP Request

Name Type Description
databaseId required string

Database ID.

HTTP Response

Status Code Content Type Payload
204  No Content - -
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/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);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = databases.delete('[DATABASE_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Databases;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $databases = new Databases($client);
    
    $result = $databases->delete('[DATABASE_ID]');
  • from appwrite.client import Client
    from appwrite.services.databases import Databases
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    databases = Databases(client)
    
    result = databases.delete('[DATABASE_ID]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    databases = Databases.new(client)
    
    response = databases.delete(database_id: '[DATABASE_ID]')
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Databases databases = Databases(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = databases.delete(
        databaseId: '[DATABASE_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Databases
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val databases = Databases(client)
    
    val response = databases.delete(
        databaseId = "[DATABASE_ID]"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Databases;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Databases databases = new Databases(client);
    
    databases.delete(
        "[DATABASE_ID]"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let databases = Databases(client)
    
    let result = try await databases.delete(
        databaseId: "[DATABASE_ID]"
    )
    
    

Create Collection

POST/v1/databases/{databaseId}/collections

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.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "collections.write" scope.

HTTP Request

Name Type Description
databaseId required string

Database ID.

collectionId required string

Unique Id. Choose your own unique ID or pass the string ID.unique() to auto generate it. 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 required string

Collection name. Max length: 128 chars.

permissions optional array

An array of permissions strings. By default no user is granted with any permissions. Learn more about permissions.

documentSecurity optional boolean

Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. Learn more about permissions.

HTTP Response

Status Code Content Type Payload
201  Created application/json Collection Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/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);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = databases.createCollection('[DATABASE_ID]', '[COLLECTION_ID]', '[NAME]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Databases;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $databases = new Databases($client);
    
    $result = $databases->createCollection('[DATABASE_ID]', '[COLLECTION_ID]', '[NAME]');
  • from appwrite.client import Client
    from appwrite.services.databases import Databases
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    databases = Databases(client)
    
    result = databases.create_collection('[DATABASE_ID]', '[COLLECTION_ID]', '[NAME]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    databases = Databases.new(client)
    
    response = databases.create_collection(database_id: '[DATABASE_ID]', collection_id: '[COLLECTION_ID]', name: '[NAME]')
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Databases databases = Databases(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = databases.createCollection(
        databaseId: '[DATABASE_ID]',
        collectionId: '[COLLECTION_ID]',
        name: '[NAME]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Databases
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val databases = Databases(client)
    
    val response = databases.createCollection(
        databaseId = "[DATABASE_ID]",
        collectionId = "[COLLECTION_ID]",
        name = "[NAME]",
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Databases;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Databases databases = new Databases(client);
    
    databases.createCollection(
        "[DATABASE_ID]",
        "[COLLECTION_ID]",
        "[NAME]",
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let databases = Databases(client)
    
    let collection = try await databases.createCollection(
        databaseId: "[DATABASE_ID]",
        collectionId: "[COLLECTION_ID]",
        name: "[NAME]"
    )
    
    

List Collections

GET/v1/databases/{databaseId}/collections

Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "collections.read" scope.

HTTP Request

Name Type Description
databaseId required string

Database ID.

queries optional array

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 optional string

Search term to filter your list results. Max length: 256 chars.

HTTP Response

Status Code Content Type Payload
200  OK application/json Collections List Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/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);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = databases.listCollections('[DATABASE_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Databases;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $databases = new Databases($client);
    
    $result = $databases->listCollections('[DATABASE_ID]');
  • from appwrite.client import Client
    from appwrite.services.databases import Databases
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    databases = Databases(client)
    
    result = databases.list_collections('[DATABASE_ID]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    databases = Databases.new(client)
    
    response = databases.list_collections(database_id: '[DATABASE_ID]')
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Databases databases = Databases(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = databases.listCollections(
        databaseId: '[DATABASE_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Databases
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val databases = Databases(client)
    
    val response = databases.listCollections(
        databaseId = "[DATABASE_ID]",
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Databases;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Databases databases = new Databases(client);
    
    databases.listCollections(
        "[DATABASE_ID]",
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let databases = Databases(client)
    
    let collectionList = try await databases.listCollections(
        databaseId: "[DATABASE_ID]"
    )
    
    

Get Collection

GET/v1/databases/{databaseId}/collections/{collectionId}

Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "collections.read" scope.

HTTP Request

Name Type Description
databaseId required string

Database ID.

collectionId required string

Collection ID.

HTTP Response

Status Code Content Type Payload
200  OK application/json Collection Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/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);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = databases.getCollection('[DATABASE_ID]', '[COLLECTION_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Databases;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $databases = new Databases($client);
    
    $result = $databases->getCollection('[DATABASE_ID]', '[COLLECTION_ID]');
  • from appwrite.client import Client
    from appwrite.services.databases import Databases
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    databases = Databases(client)
    
    result = databases.get_collection('[DATABASE_ID]', '[COLLECTION_ID]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    databases = Databases.new(client)
    
    response = databases.get_collection(database_id: '[DATABASE_ID]', collection_id: '[COLLECTION_ID]')
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Databases databases = Databases(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = databases.getCollection(
        databaseId: '[DATABASE_ID]',
        collectionId: '[COLLECTION_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Databases
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val databases = Databases(client)
    
    val response = databases.getCollection(
        databaseId = "[DATABASE_ID]",
        collectionId = "[COLLECTION_ID]"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Databases;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Databases databases = new Databases(client);
    
    databases.getCollection(
        "[DATABASE_ID]",
        "[COLLECTION_ID]"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let databases = Databases(client)
    
    let collection = try await databases.getCollection(
        databaseId: "[DATABASE_ID]",
        collectionId: "[COLLECTION_ID]"
    )
    
    

Update Collection

PUT/v1/databases/{databaseId}/collections/{collectionId}

Update a collection by its unique ID.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "collections.write" scope.

HTTP Request

Name Type Description
databaseId required string

Database ID.

collectionId required string

Collection ID.

name required string

Collection name. Max length: 128 chars.

permissions optional array

An array of permission strings. By default the current permission are inherited. Learn more about permissions.

documentSecurity optional boolean

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 optional boolean

Is collection enabled?

HTTP Response

Status Code Content Type Payload
200  OK application/json Collection Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/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);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = databases.updateCollection('[DATABASE_ID]', '[COLLECTION_ID]', '[NAME]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Databases;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $databases = new Databases($client);
    
    $result = $databases->updateCollection('[DATABASE_ID]', '[COLLECTION_ID]', '[NAME]');
  • from appwrite.client import Client
    from appwrite.services.databases import Databases
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    databases = Databases(client)
    
    result = databases.update_collection('[DATABASE_ID]', '[COLLECTION_ID]', '[NAME]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    databases = Databases.new(client)
    
    response = databases.update_collection(database_id: '[DATABASE_ID]', collection_id: '[COLLECTION_ID]', name: '[NAME]')
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Databases databases = Databases(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = databases.updateCollection(
        databaseId: '[DATABASE_ID]',
        collectionId: '[COLLECTION_ID]',
        name: '[NAME]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Databases
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val databases = Databases(client)
    
    val response = databases.updateCollection(
        databaseId = "[DATABASE_ID]",
        collectionId = "[COLLECTION_ID]",
        name = "[NAME]",
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Databases;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Databases databases = new Databases(client);
    
    databases.updateCollection(
        "[DATABASE_ID]",
        "[COLLECTION_ID]",
        "[NAME]",
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let databases = Databases(client)
    
    let collection = try await databases.updateCollection(
        databaseId: "[DATABASE_ID]",
        collectionId: "[COLLECTION_ID]",
        name: "[NAME]"
    )
    
    

Delete Collection

DELETE/v1/databases/{databaseId}/collections/{collectionId}

Delete a collection by its unique ID. Only users with write permissions have access to delete this resource.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "collections.write" scope.

HTTP Request

Name Type Description
databaseId required string

Database ID.

collectionId required string

Collection ID.

HTTP Response

Status Code Content Type Payload
204  No Content - -
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/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);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = databases.deleteCollection('[DATABASE_ID]', '[COLLECTION_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Databases;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $databases = new Databases($client);
    
    $result = $databases->deleteCollection('[DATABASE_ID]', '[COLLECTION_ID]');
  • from appwrite.client import Client
    from appwrite.services.databases import Databases
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    databases = Databases(client)
    
    result = databases.delete_collection('[DATABASE_ID]', '[COLLECTION_ID]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    databases = Databases.new(client)
    
    response = databases.delete_collection(database_id: '[DATABASE_ID]', collection_id: '[COLLECTION_ID]')
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Databases databases = Databases(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = databases.deleteCollection(
        databaseId: '[DATABASE_ID]',
        collectionId: '[COLLECTION_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Databases
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val databases = Databases(client)
    
    val response = databases.deleteCollection(
        databaseId = "[DATABASE_ID]",
        collectionId = "[COLLECTION_ID]"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Databases;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Databases databases = new Databases(client);
    
    databases.deleteCollection(
        "[DATABASE_ID]",
        "[COLLECTION_ID]"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let databases = Databases(client)
    
    let result = try await databases.deleteCollection(
        databaseId: "[DATABASE_ID]",
        collectionId: "[COLLECTION_ID]"
    )
    
    

Create String Attribute

POST/v1/databases/{databaseId}/collections/{collectionId}/attributes/string

Create a string attribute.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "collections.write" scope.

HTTP Request

Name Type Description
databaseId required string

Database ID.

collectionId required string

Collection ID. You can create a new collection using the Database service server integration.

key required string

Attribute Key.

size required integer

Attribute size for text attributes, in number of characters.

required required boolean

Is attribute required?

default optional string

Default value for attribute when not provided. Cannot be set when attribute is required.

array optional boolean

Is attribute an array?

HTTP Response

Status Code Content Type Payload
202   application/json AttributeString Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/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);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = databases.createStringAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', 1, false);
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Databases;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $databases = new Databases($client);
    
    $result = $databases->createStringAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', 1, false);
  • from appwrite.client import Client
    from appwrite.services.databases import Databases
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    databases = Databases(client)
    
    result = databases.create_string_attribute('[DATABASE_ID]', '[COLLECTION_ID]', '', 1, False)
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    databases = Databases.new(client)
    
    response = databases.create_string_attribute(database_id: '[DATABASE_ID]', collection_id: '[COLLECTION_ID]', key: '', size: 1, required: false)
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Databases databases = Databases(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = databases.createStringAttribute(
        databaseId: '[DATABASE_ID]',
        collectionId: '[COLLECTION_ID]',
        key: '',
        size: 1,
        xrequired: false,
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Databases
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val databases = Databases(client)
    
    val response = databases.createStringAttribute(
        databaseId = "[DATABASE_ID]",
        collectionId = "[COLLECTION_ID]",
        key = "",
        size = 1,
        required = false,
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Databases;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Databases databases = new Databases(client);
    
    databases.createStringAttribute(
        "[DATABASE_ID]",
        "[COLLECTION_ID]",
        "",
        1,
        false,
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let databases = Databases(client)
    
    let attributeString = try await databases.createStringAttribute(
        databaseId: "[DATABASE_ID]",
        collectionId: "[COLLECTION_ID]",
        key: "",
        size: 1,
        required: xfalse
    )
    
    

Create Email Attribute

POST/v1/databases/{databaseId}/collections/{collectionId}/attributes/email

Create an email attribute.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "collections.write" scope.

HTTP Request

Name Type Description
databaseId required string

Database ID.

collectionId required string

Collection ID. You can create a new collection using the Database service server integration.

key required string

Attribute Key.

required required boolean

Is attribute required?

default optional string

Default value for attribute when not provided. Cannot be set when attribute is required.

array optional boolean

Is attribute an array?

HTTP Response

Status Code Content Type Payload
202   application/json AttributeEmail Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/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);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = databases.createEmailAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false);
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Databases;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $databases = new Databases($client);
    
    $result = $databases->createEmailAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false);
  • from appwrite.client import Client
    from appwrite.services.databases import Databases
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    databases = Databases(client)
    
    result = databases.create_email_attribute('[DATABASE_ID]', '[COLLECTION_ID]', '', False)
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    databases = Databases.new(client)
    
    response = databases.create_email_attribute(database_id: '[DATABASE_ID]', collection_id: '[COLLECTION_ID]', key: '', required: false)
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Databases databases = Databases(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = databases.createEmailAttribute(
        databaseId: '[DATABASE_ID]',
        collectionId: '[COLLECTION_ID]',
        key: '',
        xrequired: false,
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Databases
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val databases = Databases(client)
    
    val response = databases.createEmailAttribute(
        databaseId = "[DATABASE_ID]",
        collectionId = "[COLLECTION_ID]",
        key = "",
        required = false,
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Databases;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Databases databases = new Databases(client);
    
    databases.createEmailAttribute(
        "[DATABASE_ID]",
        "[COLLECTION_ID]",
        "",
        false,
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let databases = Databases(client)
    
    let attributeEmail = try await databases.createEmailAttribute(
        databaseId: "[DATABASE_ID]",
        collectionId: "[COLLECTION_ID]",
        key: "",
        required: xfalse
    )
    
    

Create Enum Attribute

POST/v1/databases/{databaseId}/collections/{collectionId}/attributes/enum

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "collections.write" scope.

HTTP Request

Name Type Description
databaseId required string

Database ID.

collectionId required string

Collection ID. You can create a new collection using the Database service server integration.

key required string

Attribute Key.

elements required array

Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 4096 characters long.

required required boolean

Is attribute required?

default optional string

Default value for attribute when not provided. Cannot be set when attribute is required.

array optional boolean

Is attribute an array?

HTTP Response

Status Code Content Type Payload
202   application/json AttributeEnum Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/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);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = databases.createEnumAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', [], false);
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Databases;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $databases = new Databases($client);
    
    $result = $databases->createEnumAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', [], false);
  • from appwrite.client import Client
    from appwrite.services.databases import Databases
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    databases = Databases(client)
    
    result = databases.create_enum_attribute('[DATABASE_ID]', '[COLLECTION_ID]', '', [], False)
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    databases = Databases.new(client)
    
    response = databases.create_enum_attribute(database_id: '[DATABASE_ID]', collection_id: '[COLLECTION_ID]', key: '', elements: [], required: false)
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Databases databases = Databases(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = databases.createEnumAttribute(
        databaseId: '[DATABASE_ID]',
        collectionId: '[COLLECTION_ID]',
        key: '',
        elements: [],
        xrequired: false,
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Databases
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val databases = Databases(client)
    
    val response = databases.createEnumAttribute(
        databaseId = "[DATABASE_ID]",
        collectionId = "[COLLECTION_ID]",
        key = "",
        elements = listOf(),
        required = false,
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Databases;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Databases databases = new Databases(client);
    
    databases.createEnumAttribute(
        "[DATABASE_ID]",
        "[COLLECTION_ID]",
        "",
        listOf(),
        false,
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let databases = Databases(client)
    
    let attributeEnum = try await databases.createEnumAttribute(
        databaseId: "[DATABASE_ID]",
        collectionId: "[COLLECTION_ID]",
        key: "",
        elements: [],
        required: xfalse
    )
    
    

Create IP Address Attribute

POST/v1/databases/{databaseId}/collections/{collectionId}/attributes/ip

Create IP address attribute.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "collections.write" scope.

HTTP Request

Name Type Description
databaseId required string

Database ID.

collectionId required string

Collection ID. You can create a new collection using the Database service server integration.

key required string

Attribute Key.

required required boolean

Is attribute required?

default optional string

Default value for attribute when not provided. Cannot be set when attribute is required.

array optional boolean

Is attribute an array?

HTTP Response

Status Code Content Type Payload
202   application/json AttributeIP Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/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);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = databases.createIpAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false);
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Databases;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $databases = new Databases($client);
    
    $result = $databases->createIpAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false);
  • from appwrite.client import Client
    from appwrite.services.databases import Databases
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    databases = Databases(client)
    
    result = databases.create_ip_attribute('[DATABASE_ID]', '[COLLECTION_ID]', '', False)
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    databases = Databases.new(client)
    
    response = databases.create_ip_attribute(database_id: '[DATABASE_ID]', collection_id: '[COLLECTION_ID]', key: '', required: false)
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Databases databases = Databases(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = databases.createIpAttribute(
        databaseId: '[DATABASE_ID]',
        collectionId: '[COLLECTION_ID]',
        key: '',
        xrequired: false,
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Databases
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val databases = Databases(client)
    
    val response = databases.createIpAttribute(
        databaseId = "[DATABASE_ID]",
        collectionId = "[COLLECTION_ID]",
        key = "",
        required = false,
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Databases;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Databases databases = new Databases(client);
    
    databases.createIpAttribute(
        "[DATABASE_ID]",
        "[COLLECTION_ID]",
        "",
        false,
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let databases = Databases(client)
    
    let attributeIp = try await databases.createIpAttribute(
        databaseId: "[DATABASE_ID]",
        collectionId: "[COLLECTION_ID]",
        key: "",
        required: xfalse
    )
    
    

Create URL Attribute

POST/v1/databases/{databaseId}/collections/{collectionId}/attributes/url

Create a URL attribute.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "collections.write" scope.

HTTP Request

Name Type Description
databaseId required string

Database ID.

collectionId required string

Collection ID. You can create a new collection using the Database service server integration.

key required string

Attribute Key.

required required boolean

Is attribute required?

default optional string

Default value for attribute when not provided. Cannot be set when attribute is required.

array optional boolean

Is attribute an array?

HTTP Response

Status Code Content Type Payload
202   application/json AttributeURL Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/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);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = databases.createUrlAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false);
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Databases;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $databases = new Databases($client);
    
    $result = $databases->createUrlAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false);
  • from appwrite.client import Client
    from appwrite.services.databases import Databases
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    databases = Databases(client)
    
    result = databases.create_url_attribute('[DATABASE_ID]', '[COLLECTION_ID]', '', False)
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    databases = Databases.new(client)
    
    response = databases.create_url_attribute(database_id: '[DATABASE_ID]', collection_id: '[COLLECTION_ID]', key: '', required: false)
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Databases databases = Databases(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = databases.createUrlAttribute(
        databaseId: '[DATABASE_ID]',
        collectionId: '[COLLECTION_ID]',
        key: '',
        xrequired: false,
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Databases
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val databases = Databases(client)
    
    val response = databases.createUrlAttribute(
        databaseId = "[DATABASE_ID]",
        collectionId = "[COLLECTION_ID]",
        key = "",
        required = false,
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Databases;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Databases databases = new Databases(client);
    
    databases.createUrlAttribute(
        "[DATABASE_ID]",
        "[COLLECTION_ID]",
        "",
        false,
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let databases = Databases(client)
    
    let attributeUrl = try await databases.createUrlAttribute(
        databaseId: "[DATABASE_ID]",
        collectionId: "[COLLECTION_ID]",
        key: "",
        required: xfalse
    )
    
    

Create Integer Attribute

POST/v1/databases/{databaseId}/collections/{collectionId}/attributes/integer

Create an integer attribute. Optionally, minimum and maximum values can be provided.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "collections.write" scope.

HTTP Request

Name Type Description
databaseId required string

Database ID.

collectionId required string

Collection ID. You can create a new collection using the Database service server integration.

key required string

Attribute Key.

required required boolean

Is attribute required?

min optional integer

Minimum value to enforce on new documents

max optional integer

Maximum value to enforce on new documents

default optional integer

Default value for attribute when not provided. Cannot be set when attribute is required.

array optional boolean

Is attribute an array?

HTTP Response

Status Code Content Type Payload
202   application/json AttributeInteger Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/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);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = databases.createIntegerAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false);
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Databases;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $databases = new Databases($client);
    
    $result = $databases->createIntegerAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false);
  • from appwrite.client import Client
    from appwrite.services.databases import Databases
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    databases = Databases(client)
    
    result = databases.create_integer_attribute('[DATABASE_ID]', '[COLLECTION_ID]', '', False)
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    databases = Databases.new(client)
    
    response = databases.create_integer_attribute(database_id: '[DATABASE_ID]', collection_id: '[COLLECTION_ID]', key: '', required: false)
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Databases databases = Databases(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = databases.createIntegerAttribute(
        databaseId: '[DATABASE_ID]',
        collectionId: '[COLLECTION_ID]',
        key: '',
        xrequired: false,
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Databases
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val databases = Databases(client)
    
    val response = databases.createIntegerAttribute(
        databaseId = "[DATABASE_ID]",
        collectionId = "[COLLECTION_ID]",
        key = "",
        required = false,
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Databases;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Databases databases = new Databases(client);
    
    databases.createIntegerAttribute(
        "[DATABASE_ID]",
        "[COLLECTION_ID]",
        "",
        false,
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let databases = Databases(client)
    
    let attributeInteger = try await databases.createIntegerAttribute(
        databaseId: "[DATABASE_ID]",
        collectionId: "[COLLECTION_ID]",
        key: "",
        required: xfalse
    )
    
    

Create Float Attribute

POST/v1/databases/{databaseId}/collections/{collectionId}/attributes/float

Create a float attribute. Optionally, minimum and maximum values can be provided.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "collections.write" scope.

HTTP Request

Name Type Description
databaseId required string

Database ID.

collectionId required string

Collection ID. You can create a new collection using the Database service server integration.

key required string

Attribute Key.

required required boolean

Is attribute required?

min optional number

Minimum value to enforce on new documents

max optional number

Maximum value to enforce on new documents

default optional number

Default value for attribute when not provided. Cannot be set when attribute is required.

array optional boolean

Is attribute an array?

HTTP Response

Status Code Content Type Payload
202   application/json AttributeFloat Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/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);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = databases.createFloatAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false);
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Databases;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $databases = new Databases($client);
    
    $result = $databases->createFloatAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false);
  • from appwrite.client import Client
    from appwrite.services.databases import Databases
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    databases = Databases(client)
    
    result = databases.create_float_attribute('[DATABASE_ID]', '[COLLECTION_ID]', '', False)
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    databases = Databases.new(client)
    
    response = databases.create_float_attribute(database_id: '[DATABASE_ID]', collection_id: '[COLLECTION_ID]', key: '', required: false)
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Databases databases = Databases(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = databases.createFloatAttribute(
        databaseId: '[DATABASE_ID]',
        collectionId: '[COLLECTION_ID]',
        key: '',
        xrequired: false,
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Databases
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val databases = Databases(client)
    
    val response = databases.createFloatAttribute(
        databaseId = "[DATABASE_ID]",
        collectionId = "[COLLECTION_ID]",
        key = "",
        required = false,
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Databases;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Databases databases = new Databases(client);
    
    databases.createFloatAttribute(
        "[DATABASE_ID]",
        "[COLLECTION_ID]",
        "",
        false,
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let databases = Databases(client)
    
    let attributeFloat = try await databases.createFloatAttribute(
        databaseId: "[DATABASE_ID]",
        collectionId: "[COLLECTION_ID]",
        key: "",
        required: xfalse
    )
    
    

Create Boolean Attribute

POST/v1/databases/{databaseId}/collections/{collectionId}/attributes/boolean

Create a boolean attribute.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "collections.write" scope.

HTTP Request

Name Type Description
databaseId required string

Database ID.

collectionId required string

Collection ID. You can create a new collection using the Database service server integration.

key required string

Attribute Key.

required required boolean

Is attribute required?

default optional boolean

Default value for attribute when not provided. Cannot be set when attribute is required.

array optional boolean

Is attribute an array?

HTTP Response

Status Code Content Type Payload
202   application/json AttributeBoolean Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/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);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = databases.createBooleanAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false);
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Databases;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $databases = new Databases($client);
    
    $result = $databases->createBooleanAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false);
  • from appwrite.client import Client
    from appwrite.services.databases import Databases
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    databases = Databases(client)
    
    result = databases.create_boolean_attribute('[DATABASE_ID]', '[COLLECTION_ID]', '', False)
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    databases = Databases.new(client)
    
    response = databases.create_boolean_attribute(database_id: '[DATABASE_ID]', collection_id: '[COLLECTION_ID]', key: '', required: false)
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Databases databases = Databases(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = databases.createBooleanAttribute(
        databaseId: '[DATABASE_ID]',
        collectionId: '[COLLECTION_ID]',
        key: '',
        xrequired: false,
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Databases
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val databases = Databases(client)
    
    val response = databases.createBooleanAttribute(
        databaseId = "[DATABASE_ID]",
        collectionId = "[COLLECTION_ID]",
        key = "",
        required = false,
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Databases;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Databases databases = new Databases(client);
    
    databases.createBooleanAttribute(
        "[DATABASE_ID]",
        "[COLLECTION_ID]",
        "",
        false,
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let databases = Databases(client)
    
    let attributeBoolean = try await databases.createBooleanAttribute(
        databaseId: "[DATABASE_ID]",
        collectionId: "[COLLECTION_ID]",
        key: "",
        required: xfalse
    )
    
    

Create DateTime Attribute

POST/v1/databases/{databaseId}/collections/{collectionId}/attributes/datetime

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "collections.write" scope.

HTTP Request

Name Type Description
databaseId required string

Database ID.

collectionId required string

Collection ID. You can create a new collection using the Database service server integration.

key required string

Attribute Key.

required required boolean

Is attribute required?

default optional string

Default value for the attribute in ISO 8601 format. Cannot be set when attribute is required.

array optional boolean

Is attribute an array?

HTTP Response

Status Code Content Type Payload
202   application/json AttributeDatetime Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/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);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = databases.createDatetimeAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false);
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Databases;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $databases = new Databases($client);
    
    $result = $databases->createDatetimeAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false);
  • from appwrite.client import Client
    from appwrite.services.databases import Databases
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    databases = Databases(client)
    
    result = databases.create_datetime_attribute('[DATABASE_ID]', '[COLLECTION_ID]', '', False)
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    databases = Databases.new(client)
    
    response = databases.create_datetime_attribute(database_id: '[DATABASE_ID]', collection_id: '[COLLECTION_ID]', key: '', required: false)
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Databases databases = Databases(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = databases.createDatetimeAttribute(
        databaseId: '[DATABASE_ID]',
        collectionId: '[COLLECTION_ID]',
        key: '',
        xrequired: false,
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Databases
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val databases = Databases(client)
    
    val response = databases.createDatetimeAttribute(
        databaseId = "[DATABASE_ID]",
        collectionId = "[COLLECTION_ID]",
        key = "",
        required = false,
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Databases;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Databases databases = new Databases(client);
    
    databases.createDatetimeAttribute(
        "[DATABASE_ID]",
        "[COLLECTION_ID]",
        "",
        false,
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let databases = Databases(client)
    
    let attributeDatetime = try await databases.createDatetimeAttribute(
        databaseId: "[DATABASE_ID]",
        collectionId: "[COLLECTION_ID]",
        key: "",
        required: xfalse
    )
    
    

List Attributes

GET/v1/databases/{databaseId}/collections/{collectionId}/attributes

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "collections.read" scope.

HTTP Request

Name Type Description
databaseId required string

Database ID.

collectionId required string

Collection ID. You can create a new collection using the Database service server integration.

HTTP Response

Status Code Content Type Payload
200  OK application/json Attributes List Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/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);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = databases.listAttributes('[DATABASE_ID]', '[COLLECTION_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Databases;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $databases = new Databases($client);
    
    $result = $databases->listAttributes('[DATABASE_ID]', '[COLLECTION_ID]');
  • from appwrite.client import Client
    from appwrite.services.databases import Databases
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    databases = Databases(client)
    
    result = databases.list_attributes('[DATABASE_ID]', '[COLLECTION_ID]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    databases = Databases.new(client)
    
    response = databases.list_attributes(database_id: '[DATABASE_ID]', collection_id: '[COLLECTION_ID]')
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Databases databases = Databases(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = databases.listAttributes(
        databaseId: '[DATABASE_ID]',
        collectionId: '[COLLECTION_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Databases
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val databases = Databases(client)
    
    val response = databases.listAttributes(
        databaseId = "[DATABASE_ID]",
        collectionId = "[COLLECTION_ID]"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Databases;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Databases databases = new Databases(client);
    
    databases.listAttributes(
        "[DATABASE_ID]",
        "[COLLECTION_ID]"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let databases = Databases(client)
    
    let attributeList = try await databases.listAttributes(
        databaseId: "[DATABASE_ID]",
        collectionId: "[COLLECTION_ID]"
    )
    
    

Get Attribute

GET/v1/databases/{databaseId}/collections/{collectionId}/attributes/{key}

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "collections.read" scope.

HTTP Request

Name Type Description
databaseId required string

Database ID.

collectionId required string

Collection ID. You can create a new collection using the Database service server integration.

key required string

Attribute Key.

HTTP Response

Status Code Content Type Payload
200  OK application/json attributeDatetime
attributeBoolean
attributeInteger
attributeFloat
attributeEmail
attributeEnum
attributeUrl
attributeIp
attributeDatetime
attributeString
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/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);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = databases.getAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Databases;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $databases = new Databases($client);
    
    $result = $databases->getAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '');
  • from appwrite.client import Client
    from appwrite.services.databases import Databases
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    databases = Databases(client)
    
    result = databases.get_attribute('[DATABASE_ID]', '[COLLECTION_ID]', '')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    databases = Databases.new(client)
    
    response = databases.get_attribute(database_id: '[DATABASE_ID]', collection_id: '[COLLECTION_ID]', key: '')
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Databases databases = Databases(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = databases.getAttribute(
        databaseId: '[DATABASE_ID]',
        collectionId: '[COLLECTION_ID]',
        key: '',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Databases
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val databases = Databases(client)
    
    val response = databases.getAttribute(
        databaseId = "[DATABASE_ID]",
        collectionId = "[COLLECTION_ID]",
        key = ""
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Databases;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Databases databases = new Databases(client);
    
    databases.getAttribute(
        "[DATABASE_ID]",
        "[COLLECTION_ID]",
        ""
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let databases = Databases(client)
    
    let result = try await databases.getAttribute(
        databaseId: "[DATABASE_ID]",
        collectionId: "[COLLECTION_ID]",
        key: ""
    )
    
    

Delete Attribute

DELETE/v1/databases/{databaseId}/collections/{collectionId}/attributes/{key}

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "collections.write" scope.

HTTP Request

Name Type Description
databaseId required string

Database ID.

collectionId required string

Collection ID. You can create a new collection using the Database service server integration.

key required string

Attribute Key.

HTTP Response

Status Code Content Type Payload
204  No Content - -
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/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);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = databases.deleteAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Databases;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $databases = new Databases($client);
    
    $result = $databases->deleteAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '');
  • from appwrite.client import Client
    from appwrite.services.databases import Databases
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    databases = Databases(client)
    
    result = databases.delete_attribute('[DATABASE_ID]', '[COLLECTION_ID]', '')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    databases = Databases.new(client)
    
    response = databases.delete_attribute(database_id: '[DATABASE_ID]', collection_id: '[COLLECTION_ID]', key: '')
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Databases databases = Databases(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = databases.deleteAttribute(
        databaseId: '[DATABASE_ID]',
        collectionId: '[COLLECTION_ID]',
        key: '',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Databases
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val databases = Databases(client)
    
    val response = databases.deleteAttribute(
        databaseId = "[DATABASE_ID]",
        collectionId = "[COLLECTION_ID]",
        key = ""
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Databases;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Databases databases = new Databases(client);
    
    databases.deleteAttribute(
        "[DATABASE_ID]",
        "[COLLECTION_ID]",
        ""
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let databases = Databases(client)
    
    let result = try await databases.deleteAttribute(
        databaseId: "[DATABASE_ID]",
        collectionId: "[COLLECTION_ID]",
        key: ""
    )
    
    

Create Index

POST/v1/databases/{databaseId}/collections/{collectionId}/indexes

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "collections.write" scope.

HTTP Request

Name Type Description
databaseId required string

Database ID.

collectionId required string

Collection ID. You can create a new collection using the Database service server integration.

key required string

Index Key.

type required string

Index type.

attributes required array

Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long.

orders optional array

Array of index orders. Maximum of 100 orders are allowed.

HTTP Response

Status Code Content Type Payload
202   application/json Index Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/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);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = databases.createIndex('[DATABASE_ID]', '[COLLECTION_ID]', '', 'key', []);
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Databases;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $databases = new Databases($client);
    
    $result = $databases->createIndex('[DATABASE_ID]', '[COLLECTION_ID]', '', 'key', []);
  • from appwrite.client import Client
    from appwrite.services.databases import Databases
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    databases = Databases(client)
    
    result = databases.create_index('[DATABASE_ID]', '[COLLECTION_ID]', '', 'key', [])
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    databases = Databases.new(client)
    
    response = databases.create_index(database_id: '[DATABASE_ID]', collection_id: '[COLLECTION_ID]', key: '', type: 'key', attributes: [])
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Databases databases = Databases(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = databases.createIndex(
        databaseId: '[DATABASE_ID]',
        collectionId: '[COLLECTION_ID]',
        key: '',
        type: 'key',
        attributes: [],
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Databases
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val databases = Databases(client)
    
    val response = databases.createIndex(
        databaseId = "[DATABASE_ID]",
        collectionId = "[COLLECTION_ID]",
        key = "",
        type = "key",
        attributes = listOf(),
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Databases;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Databases databases = new Databases(client);
    
    databases.createIndex(
        "[DATABASE_ID]",
        "[COLLECTION_ID]",
        "",
        "key",
        listOf(),
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let databases = Databases(client)
    
    let index = try await databases.createIndex(
        databaseId: "[DATABASE_ID]",
        collectionId: "[COLLECTION_ID]",
        key: "",
        type: "key",
        attributes: []
    )
    
    

List Indexes

GET/v1/databases/{databaseId}/collections/{collectionId}/indexes

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "collections.read" scope.

HTTP Request

Name Type Description
databaseId required string

Database ID.

collectionId required string

Collection ID. You can create a new collection using the Database service server integration.

HTTP Response

Status Code Content Type Payload
200  OK application/json Indexes List Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/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);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = databases.listIndexes('[DATABASE_ID]', '[COLLECTION_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Databases;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $databases = new Databases($client);
    
    $result = $databases->listIndexes('[DATABASE_ID]', '[COLLECTION_ID]');
  • from appwrite.client import Client
    from appwrite.services.databases import Databases
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    databases = Databases(client)
    
    result = databases.list_indexes('[DATABASE_ID]', '[COLLECTION_ID]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    databases = Databases.new(client)
    
    response = databases.list_indexes(database_id: '[DATABASE_ID]', collection_id: '[COLLECTION_ID]')
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Databases databases = Databases(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = databases.listIndexes(
        databaseId: '[DATABASE_ID]',
        collectionId: '[COLLECTION_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Databases
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val databases = Databases(client)
    
    val response = databases.listIndexes(
        databaseId = "[DATABASE_ID]",
        collectionId = "[COLLECTION_ID]"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Databases;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Databases databases = new Databases(client);
    
    databases.listIndexes(
        "[DATABASE_ID]",
        "[COLLECTION_ID]"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let databases = Databases(client)
    
    let indexList = try await databases.listIndexes(
        databaseId: "[DATABASE_ID]",
        collectionId: "[COLLECTION_ID]"
    )
    
    

Get Index

GET/v1/databases/{databaseId}/collections/{collectionId}/indexes/{key}

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "collections.read" scope.

HTTP Request

Name Type Description
databaseId required string

Database ID.

collectionId required string

Collection ID. You can create a new collection using the Database service server integration.

key required string

Index Key.

HTTP Response

Status Code Content Type Payload
200  OK application/json Index Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/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);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = databases.getIndex('[DATABASE_ID]', '[COLLECTION_ID]', '');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Databases;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $databases = new Databases($client);
    
    $result = $databases->getIndex('[DATABASE_ID]', '[COLLECTION_ID]', '');
  • from appwrite.client import Client
    from appwrite.services.databases import Databases
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    databases = Databases(client)
    
    result = databases.get_index('[DATABASE_ID]', '[COLLECTION_ID]', '')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    databases = Databases.new(client)
    
    response = databases.get_index(database_id: '[DATABASE_ID]', collection_id: '[COLLECTION_ID]', key: '')
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Databases databases = Databases(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = databases.getIndex(
        databaseId: '[DATABASE_ID]',
        collectionId: '[COLLECTION_ID]',
        key: '',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Databases
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val databases = Databases(client)
    
    val response = databases.getIndex(
        databaseId = "[DATABASE_ID]",
        collectionId = "[COLLECTION_ID]",
        key = ""
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Databases;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Databases databases = new Databases(client);
    
    databases.getIndex(
        "[DATABASE_ID]",
        "[COLLECTION_ID]",
        ""
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let databases = Databases(client)
    
    let index = try await databases.getIndex(
        databaseId: "[DATABASE_ID]",
        collectionId: "[COLLECTION_ID]",
        key: ""
    )
    
    

Delete Index

DELETE/v1/databases/{databaseId}/collections/{collectionId}/indexes/{key}

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "collections.write" scope.

HTTP Request

Name Type Description
databaseId required string

Database ID.

collectionId required string

Collection ID. You can create a new collection using the Database service server integration.

key required string

Index Key.

HTTP Response

Status Code Content Type Payload
204  No Content - -
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/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);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = databases.deleteIndex('[DATABASE_ID]', '[COLLECTION_ID]', '');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Databases;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $databases = new Databases($client);
    
    $result = $databases->deleteIndex('[DATABASE_ID]', '[COLLECTION_ID]', '');
  • from appwrite.client import Client
    from appwrite.services.databases import Databases
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    databases = Databases(client)
    
    result = databases.delete_index('[DATABASE_ID]', '[COLLECTION_ID]', '')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    databases = Databases.new(client)
    
    response = databases.delete_index(database_id: '[DATABASE_ID]', collection_id: '[COLLECTION_ID]', key: '')
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Databases databases = Databases(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = databases.deleteIndex(
        databaseId: '[DATABASE_ID]',
        collectionId: '[COLLECTION_ID]',
        key: '',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Databases
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val databases = Databases(client)
    
    val response = databases.deleteIndex(
        databaseId = "[DATABASE_ID]",
        collectionId = "[COLLECTION_ID]",
        key = ""
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Databases;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Databases databases = new Databases(client);
    
    databases.deleteIndex(
        "[DATABASE_ID]",
        "[COLLECTION_ID]",
        ""
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let databases = Databases(client)
    
    let result = try await databases.deleteIndex(
        databaseId: "[DATABASE_ID]",
        collectionId: "[COLLECTION_ID]",
        key: ""
    )
    
    

Create Document

POST/v1/databases/{databaseId}/collections/{collectionId}/documents

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.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is created with the "documents.write" scope. You can also authenticate using a valid JWT and perform actions on behalf of your user.

Rate Limits

This endpoint is limited to 120 requests in every 1 minutes per IP address, method and user account. We use rate limits to avoid service abuse by users and as a security practice. Learn more about rate limiting.

HTTP Request

Name Type Description
databaseId required string

Database ID.

collectionId required string

Collection ID. You can create a new collection using the Database service server integration. Make sure to define attributes before creating documents.

documentId required string

Document ID. Choose your own unique ID or pass the string ID.unique() to auto generate it. 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 required object

Document data as JSON object.

permissions optional array

An array of permissions strings. By default the current user is granted with all permissions. Learn more about permissions.

HTTP Response

Status Code Content Type Payload
201  Created application/json Document Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/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);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = databases.createDocument('[DATABASE_ID]', '[COLLECTION_ID]', '[DOCUMENT_ID]', {});
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Databases;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $databases = new Databases($client);
    
    $result = $databases->createDocument('[DATABASE_ID]', '[COLLECTION_ID]', '[DOCUMENT_ID]', []);
  • from appwrite.client import Client
    from appwrite.services.databases import Databases
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    databases = Databases(client)
    
    result = databases.create_document('[DATABASE_ID]', '[COLLECTION_ID]', '[DOCUMENT_ID]', {})
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    databases = Databases.new(client)
    
    response = databases.create_document(database_id: '[DATABASE_ID]', collection_id: '[COLLECTION_ID]', document_id: '[DOCUMENT_ID]', data: {})
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Databases databases = Databases(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = databases.createDocument(
        databaseId: '[DATABASE_ID]',
        collectionId: '[COLLECTION_ID]',
        documentId: '[DOCUMENT_ID]',
        data: {},
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Databases
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val databases = Databases(client)
    
    val response = databases.createDocument(
        databaseId = "[DATABASE_ID]",
        collectionId = "[COLLECTION_ID]",
        documentId = "[DOCUMENT_ID]",
        data = mapOf( "a" to "b" ),
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Databases;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Databases databases = new Databases(client);
    
    databases.createDocument(
        "[DATABASE_ID]",
        "[COLLECTION_ID]",
        "[DOCUMENT_ID]",
        mapOf( "a" to "b" ),
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let databases = Databases(client)
    
    let document = try await databases.createDocument(
        databaseId: "[DATABASE_ID]",
        collectionId: "[COLLECTION_ID]",
        documentId: "[DOCUMENT_ID]",
        data: [:]
    )
    
    

List Documents

GET/v1/databases/{databaseId}/collections/{collectionId}/documents

Get a list of all the user's documents in a given collection. You can use the query params to filter your results.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is created with the "documents.read" scope. You can also authenticate using a valid JWT and perform actions on behalf of your user.

HTTP Request

Name Type Description
databaseId required string

Database ID.

collectionId required string

Collection ID. You can create a new collection using the Database service server integration.

queries optional array

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.

HTTP Response

Status Code Content Type Payload
200  OK application/json Documents List Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/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);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = databases.listDocuments('[DATABASE_ID]', '[COLLECTION_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Databases;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $databases = new Databases($client);
    
    $result = $databases->listDocuments('[DATABASE_ID]', '[COLLECTION_ID]');
  • from appwrite.client import Client
    from appwrite.services.databases import Databases
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    databases = Databases(client)
    
    result = databases.list_documents('[DATABASE_ID]', '[COLLECTION_ID]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    databases = Databases.new(client)
    
    response = databases.list_documents(database_id: '[DATABASE_ID]', collection_id: '[COLLECTION_ID]')
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Databases databases = Databases(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = databases.listDocuments(
        databaseId: '[DATABASE_ID]',
        collectionId: '[COLLECTION_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Databases
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val databases = Databases(client)
    
    val response = databases.listDocuments(
        databaseId = "[DATABASE_ID]",
        collectionId = "[COLLECTION_ID]",
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Databases;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Databases databases = new Databases(client);
    
    databases.listDocuments(
        "[DATABASE_ID]",
        "[COLLECTION_ID]",
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let databases = Databases(client)
    
    let documentList = try await databases.listDocuments(
        databaseId: "[DATABASE_ID]",
        collectionId: "[COLLECTION_ID]"
    )
    
    

Get Document

GET/v1/databases/{databaseId}/collections/{collectionId}/documents/{documentId}

Get a document by its unique ID. This endpoint response returns a JSON object with the document data.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is created with the "documents.read" scope. You can also authenticate using a valid JWT and perform actions on behalf of your user.

HTTP Request

Name Type Description
databaseId required string

Database ID.

collectionId required string

Collection ID. You can create a new collection using the Database service server integration.

documentId required string

Document ID.

HTTP Response

Status Code Content Type Payload
200  OK application/json Document Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/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);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = databases.getDocument('[DATABASE_ID]', '[COLLECTION_ID]', '[DOCUMENT_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Databases;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $databases = new Databases($client);
    
    $result = $databases->getDocument('[DATABASE_ID]', '[COLLECTION_ID]', '[DOCUMENT_ID]');
  • from appwrite.client import Client
    from appwrite.services.databases import Databases
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    databases = Databases(client)
    
    result = databases.get_document('[DATABASE_ID]', '[COLLECTION_ID]', '[DOCUMENT_ID]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    databases = Databases.new(client)
    
    response = databases.get_document(database_id: '[DATABASE_ID]', collection_id: '[COLLECTION_ID]', document_id: '[DOCUMENT_ID]')
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Databases databases = Databases(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = databases.getDocument(
        databaseId: '[DATABASE_ID]',
        collectionId: '[COLLECTION_ID]',
        documentId: '[DOCUMENT_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Databases
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val databases = Databases(client)
    
    val response = databases.getDocument(
        databaseId = "[DATABASE_ID]",
        collectionId = "[COLLECTION_ID]",
        documentId = "[DOCUMENT_ID]"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Databases;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Databases databases = new Databases(client);
    
    databases.getDocument(
        "[DATABASE_ID]",
        "[COLLECTION_ID]",
        "[DOCUMENT_ID]"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let databases = Databases(client)
    
    let document = try await databases.getDocument(
        databaseId: "[DATABASE_ID]",
        collectionId: "[COLLECTION_ID]",
        documentId: "[DOCUMENT_ID]"
    )
    
    

Update Document

PATCH/v1/databases/{databaseId}/collections/{collectionId}/documents/{documentId}

Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is created with the "documents.write" scope. You can also authenticate using a valid JWT and perform actions on behalf of your user.

Rate Limits

This endpoint is limited to 120 requests in every 1 minutes per IP address, method and user account. We use rate limits to avoid service abuse by users and as a security practice. Learn more about rate limiting.

HTTP Request

Name Type Description
databaseId required string

Database ID.

collectionId required string

Collection ID.

documentId required string

Document ID.

data optional object

Document data as JSON object. Include only attribute and value pairs to be updated.

permissions optional array

An array of permissions strings. By default the current permissions are inherited. Learn more about permissions.

HTTP Response

Status Code Content Type Payload
200  OK application/json Document Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/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);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = databases.updateDocument('[DATABASE_ID]', '[COLLECTION_ID]', '[DOCUMENT_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Databases;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $databases = new Databases($client);
    
    $result = $databases->updateDocument('[DATABASE_ID]', '[COLLECTION_ID]', '[DOCUMENT_ID]');
  • from appwrite.client import Client
    from appwrite.services.databases import Databases
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    databases = Databases(client)
    
    result = databases.update_document('[DATABASE_ID]', '[COLLECTION_ID]', '[DOCUMENT_ID]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    databases = Databases.new(client)
    
    response = databases.update_document(database_id: '[DATABASE_ID]', collection_id: '[COLLECTION_ID]', document_id: '[DOCUMENT_ID]')
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Databases databases = Databases(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = databases.updateDocument(
        databaseId: '[DATABASE_ID]',
        collectionId: '[COLLECTION_ID]',
        documentId: '[DOCUMENT_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Databases
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val databases = Databases(client)
    
    val response = databases.updateDocument(
        databaseId = "[DATABASE_ID]",
        collectionId = "[COLLECTION_ID]",
        documentId = "[DOCUMENT_ID]",
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Databases;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Databases databases = new Databases(client);
    
    databases.updateDocument(
        "[DATABASE_ID]",
        "[COLLECTION_ID]",
        "[DOCUMENT_ID]",
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let databases = Databases(client)
    
    let document = try await databases.updateDocument(
        databaseId: "[DATABASE_ID]",
        collectionId: "[COLLECTION_ID]",
        documentId: "[DOCUMENT_ID]"
    )
    
    

Delete Document

DELETE/v1/databases/{databaseId}/collections/{collectionId}/documents/{documentId}

Delete a document by its unique ID.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is created with the "documents.write" scope. You can also authenticate using a valid JWT and perform actions on behalf of your user.

Rate Limits

This endpoint is limited to 60 requests in every 1 minutes per IP address, method and user account. We use rate limits to avoid service abuse by users and as a security practice. Learn more about rate limiting.

HTTP Request

Name Type Description
databaseId required string

Database ID.

collectionId required string

Collection ID. You can create a new collection using the Database service server integration.

documentId required string

Document ID.

HTTP Response

Status Code Content Type Payload
204  No Content - -
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/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);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let databases = new sdk.Databases(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = databases.deleteDocument('[DATABASE_ID]', '[COLLECTION_ID]', '[DOCUMENT_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Databases;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $databases = new Databases($client);
    
    $result = $databases->deleteDocument('[DATABASE_ID]', '[COLLECTION_ID]', '[DOCUMENT_ID]');
  • from appwrite.client import Client
    from appwrite.services.databases import Databases
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    databases = Databases(client)
    
    result = databases.delete_document('[DATABASE_ID]', '[COLLECTION_ID]', '[DOCUMENT_ID]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    databases = Databases.new(client)
    
    response = databases.delete_document(database_id: '[DATABASE_ID]', collection_id: '[COLLECTION_ID]', document_id: '[DOCUMENT_ID]')
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Databases databases = Databases(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = databases.deleteDocument(
        databaseId: '[DATABASE_ID]',
        collectionId: '[COLLECTION_ID]',
        documentId: '[DOCUMENT_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Databases
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val databases = Databases(client)
    
    val response = databases.deleteDocument(
        databaseId = "[DATABASE_ID]",
        collectionId = "[COLLECTION_ID]",
        documentId = "[DOCUMENT_ID]"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Databases;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Databases databases = new Databases(client);
    
    databases.deleteDocument(
        "[DATABASE_ID]",
        "[COLLECTION_ID]",
        "[DOCUMENT_ID]"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let databases = Databases(client)
    
    let result = try await databases.deleteDocument(
        databaseId: "[DATABASE_ID]",
        collectionId: "[COLLECTION_ID]",
        documentId: "[DOCUMENT_ID]"
    )