We've raised a $10M seed round! 🚀
Docs

Users API


Server integration with  

The Users service allows you to manage your project users. Use this service to search, block, and view your users' info, current sessions, and latest activity logs. You can also use the Users service to edit your users' preferences and personal info.

Users API vs Account API

While the Users API is integrated from the server-side and operates in an admin scope with access to all your project users, the Account API operates in the scope of the current logged in user and usually using a client-side integration.

Some of the Account API methods are available from the server SDK when you authenticate with JWT. This allows you to perform server-side actions on behalf of your project user.

Create User

POST/v1/users

Create a new user.

Authentication

To access this route, init your SDK with your project unique ID and API Key secret token. Make sure your API Key is granted with access to the "users.write" permission scope.

Request

Name Type Description
email required string

User email.

password required string

User password. Must be between 6 to 32 chars.

name optional string

User name. Max length: 128 chars.

Response

Status Code Content Type Payload
201  Created application/json User Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    let client = new sdk.Client();
    
    let users = new sdk.Users(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 = users.create('email@example.com', 'password');
    
    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 users = new sdk.Users(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 = users.create('email@example.com', 'password');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Users;
    
    $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
    ;
    
    $users = new Users($client);
    
    $result = $users->create('email@example.com', 'password');
  • from appwrite.client import Client
    from appwrite.services.users import Users
    
    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
    )
    
    users = Users(client)
    
    result = users.create('email@example.com', 'password')
    
  • require 'appwrite'
    
    client = Appwrite::Client.new()
    
    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
    ;
    
    users = Appwrite::Users.new(client);
    
    response = users.create(email: 'email@example.com', password: 'password');
    
    puts response
  • using Appwrite;
    
    Client 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
    ;
    
    Users users = new Users(client);
    
    HttpResponseMessage result = await users.Create("email@example.com", "password");
    
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Users users = Users(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 = users.create(
        email: 'email@example.com',
        password: 'password',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • appwrite users create \
            --email="email@example.com" \
            --password="password" \
            --name="[NAME]"
    
  • import io.appwrite.Client
    import io.appwrite.services.Users
    
    suspend fun main() {
        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 users = Users(client)
        val response = users.create(
            email = "email@example.com",
            password = "password",
        )
        val json = response.body?.string()
    }
  • import io.appwrite.Client
    import io.appwrite.services.Users
    
    public void main() {
        Client client = Client(context)
            .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
            .setProject("5df5acd0d48c2") // Your project ID
            .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
        Users users = new Users(client);
        users.create(
            email = "email@example.com",
            password = "password",
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }

List Users

GET/v1/users

Get a list of all the project's users. You can use the query params to filter your results.

Authentication

To access this route, init your SDK with your project unique ID and API Key secret token. Make sure your API Key is granted with access to the "users.read" permission scope.

Request

Name Type Description
search optional string

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

limit optional integer

Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.

offset optional integer

Results offset. The default value is 0. Use this param to manage pagination.

orderType optional string

Order result by ASC or DESC order.

Response

Status Code Content Type Payload
200  OK application/json Users List Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    let client = new sdk.Client();
    
    let users = new sdk.Users(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 = users.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 users = new sdk.Users(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 = users.list();
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Users;
    
    $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
    ;
    
    $users = new Users($client);
    
    $result = $users->list();
  • from appwrite.client import Client
    from appwrite.services.users import Users
    
    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
    )
    
    users = Users(client)
    
    result = users.list()
    
  • require 'appwrite'
    
    client = Appwrite::Client.new()
    
    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
    ;
    
    users = Appwrite::Users.new(client);
    
    response = users.list();
    
    puts response
  • using Appwrite;
    
    Client 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
    ;
    
    Users users = new Users(client);
    
    HttpResponseMessage result = await users.List();
    
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Users users = Users(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 = users.list(
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • appwrite users list \
            --search="[SEARCH]" \
            --limit="0" \
            --offset="0" \
            --orderType="ASC"
    
  • import io.appwrite.Client
    import io.appwrite.services.Users
    
    suspend fun main() {
        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 users = Users(client)
        val response = users.list(
        )
        val json = response.body?.string()
    }
  • import io.appwrite.Client
    import io.appwrite.services.Users
    
    public void main() {
        Client client = Client(context)
            .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
            .setProject("5df5acd0d48c2") // Your project ID
            .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
        Users users = new Users(client);
        users.list(
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }

Get User

GET/v1/users/{userId}

Get a user by its unique ID.

Authentication

To access this route, init your SDK with your project unique ID and API Key secret token. Make sure your API Key is granted with access to the "users.read" permission scope.

Request

Name Type Description
userId required string

User unique ID.

Response

Status Code Content Type Payload
200  OK application/json User Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    let client = new sdk.Client();
    
    let users = new sdk.Users(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 = users.get('[USER_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 users = new sdk.Users(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 = users.get('[USER_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Users;
    
    $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
    ;
    
    $users = new Users($client);
    
    $result = $users->get('[USER_ID]');
  • from appwrite.client import Client
    from appwrite.services.users import Users
    
    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
    )
    
    users = Users(client)
    
    result = users.get('[USER_ID]')
    
  • require 'appwrite'
    
    client = Appwrite::Client.new()
    
    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
    ;
    
    users = Appwrite::Users.new(client);
    
    response = users.get(user_id: '[USER_ID]');
    
    puts response
  • using Appwrite;
    
    Client 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
    ;
    
    Users users = new Users(client);
    
    HttpResponseMessage result = await users.Get("[USER_ID]");
    
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Users users = Users(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 = users.get(
        userId: '[USER_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • appwrite users get \
            --userId="[USER_ID]"
    
  • import io.appwrite.Client
    import io.appwrite.services.Users
    
    suspend fun main() {
        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 users = Users(client)
        val response = users.get(
            userId = "[USER_ID]"
        )
        val json = response.body?.string()
    }
  • import io.appwrite.Client
    import io.appwrite.services.Users
    
    public void main() {
        Client client = Client(context)
            .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
            .setProject("5df5acd0d48c2") // Your project ID
            .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
        Users users = new Users(client);
        users.get(
            userId = "[USER_ID]"
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }

Get User Preferences

GET/v1/users/{userId}/prefs

Get the user preferences by its unique ID.

Authentication

To access this route, init your SDK with your project unique ID and API Key secret token. Make sure your API Key is granted with access to the "users.read" permission scope.

Request

Name Type Description
userId required string

User unique ID.

Response

Status Code Content Type Payload
200  OK application/json Preferences Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    let client = new sdk.Client();
    
    let users = new sdk.Users(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 = users.getPrefs('[USER_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 users = new sdk.Users(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 = users.getPrefs('[USER_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Users;
    
    $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
    ;
    
    $users = new Users($client);
    
    $result = $users->getPrefs('[USER_ID]');
  • from appwrite.client import Client
    from appwrite.services.users import Users
    
    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
    )
    
    users = Users(client)
    
    result = users.get_prefs('[USER_ID]')
    
  • require 'appwrite'
    
    client = Appwrite::Client.new()
    
    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
    ;
    
    users = Appwrite::Users.new(client);
    
    response = users.get_prefs(user_id: '[USER_ID]');
    
    puts response
  • using Appwrite;
    
    Client 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
    ;
    
    Users users = new Users(client);
    
    HttpResponseMessage result = await users.GetPrefs("[USER_ID]");
    
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Users users = Users(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 = users.getPrefs(
        userId: '[USER_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • appwrite users getPrefs \
            --userId="[USER_ID]"
    
  • import io.appwrite.Client
    import io.appwrite.services.Users
    
    suspend fun main() {
        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 users = Users(client)
        val response = users.getPrefs(
            userId = "[USER_ID]"
        )
        val json = response.body?.string()
    }
  • import io.appwrite.Client
    import io.appwrite.services.Users
    
    public void main() {
        Client client = Client(context)
            .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
            .setProject("5df5acd0d48c2") // Your project ID
            .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
        Users users = new Users(client);
        users.getPrefs(
            userId = "[USER_ID]"
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }

Get User Sessions

GET/v1/users/{userId}/sessions

Get the user sessions list by its unique ID.

Authentication

To access this route, init your SDK with your project unique ID and API Key secret token. Make sure your API Key is granted with access to the "users.read" permission scope.

Request

Name Type Description
userId required string

User unique ID.

Response

Status Code Content Type Payload
200  OK application/json Sessions List Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    let client = new sdk.Client();
    
    let users = new sdk.Users(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 = users.getSessions('[USER_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 users = new sdk.Users(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 = users.getSessions('[USER_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Users;
    
    $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
    ;
    
    $users = new Users($client);
    
    $result = $users->getSessions('[USER_ID]');
  • from appwrite.client import Client
    from appwrite.services.users import Users
    
    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
    )
    
    users = Users(client)
    
    result = users.get_sessions('[USER_ID]')
    
  • require 'appwrite'
    
    client = Appwrite::Client.new()
    
    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
    ;
    
    users = Appwrite::Users.new(client);
    
    response = users.get_sessions(user_id: '[USER_ID]');
    
    puts response
  • using Appwrite;
    
    Client 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
    ;
    
    Users users = new Users(client);
    
    HttpResponseMessage result = await users.GetSessions("[USER_ID]");
    
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Users users = Users(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 = users.getSessions(
        userId: '[USER_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • appwrite users getSessions \
            --userId="[USER_ID]"
    
  • import io.appwrite.Client
    import io.appwrite.services.Users
    
    suspend fun main() {
        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 users = Users(client)
        val response = users.getSessions(
            userId = "[USER_ID]"
        )
        val json = response.body?.string()
    }
  • import io.appwrite.Client
    import io.appwrite.services.Users
    
    public void main() {
        Client client = Client(context)
            .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
            .setProject("5df5acd0d48c2") // Your project ID
            .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
        Users users = new Users(client);
        users.getSessions(
            userId = "[USER_ID]"
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }

Get User Logs

GET/v1/users/{userId}/logs

Get a user activity logs list by its unique ID.

Authentication

To access this route, init your SDK with your project unique ID and API Key secret token. Make sure your API Key is granted with access to the "users.read" permission scope.

Request

Name Type Description
userId required string

User unique ID.

Response

Status Code Content Type Payload
200  OK application/json Logs List Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    let client = new sdk.Client();
    
    let users = new sdk.Users(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 = users.getLogs('[USER_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 users = new sdk.Users(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 = users.getLogs('[USER_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Users;
    
    $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
    ;
    
    $users = new Users($client);
    
    $result = $users->getLogs('[USER_ID]');
  • from appwrite.client import Client
    from appwrite.services.users import Users
    
    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
    )
    
    users = Users(client)
    
    result = users.get_logs('[USER_ID]')
    
  • require 'appwrite'
    
    client = Appwrite::Client.new()
    
    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
    ;
    
    users = Appwrite::Users.new(client);
    
    response = users.get_logs(user_id: '[USER_ID]');
    
    puts response
  • using Appwrite;
    
    Client 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
    ;
    
    Users users = new Users(client);
    
    HttpResponseMessage result = await users.GetLogs("[USER_ID]");
    
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Users users = Users(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 = users.getLogs(
        userId: '[USER_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • appwrite users getLogs \
            --userId="[USER_ID]"
    
  • import io.appwrite.Client
    import io.appwrite.services.Users
    
    suspend fun main() {
        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 users = Users(client)
        val response = users.getLogs(
            userId = "[USER_ID]"
        )
        val json = response.body?.string()
    }
  • import io.appwrite.Client
    import io.appwrite.services.Users
    
    public void main() {
        Client client = Client(context)
            .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
            .setProject("5df5acd0d48c2") // Your project ID
            .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
        Users users = new Users(client);
        users.getLogs(
            userId = "[USER_ID]"
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }

Update User Status

PATCH/v1/users/{userId}/status

Update the user status by its unique ID.

Authentication

To access this route, init your SDK with your project unique ID and API Key secret token. Make sure your API Key is granted with access to the "users.write" permission scope.

Request

Name Type Description
userId required string

User unique ID.

status required integer

User Status code. To activate the user pass 1, to block the user pass 2 and for disabling the user pass 0

Response

Status Code Content Type Payload
200  OK application/json User Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    let client = new sdk.Client();
    
    let users = new sdk.Users(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 = users.updateStatus('[USER_ID]', 1);
    
    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 users = new sdk.Users(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 = users.updateStatus('[USER_ID]', 1);
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Users;
    
    $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
    ;
    
    $users = new Users($client);
    
    $result = $users->updateStatus('[USER_ID]', 1);
  • from appwrite.client import Client
    from appwrite.services.users import Users
    
    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
    )
    
    users = Users(client)
    
    result = users.update_status('[USER_ID]', 1)
    
  • require 'appwrite'
    
    client = Appwrite::Client.new()
    
    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
    ;
    
    users = Appwrite::Users.new(client);
    
    response = users.update_status(user_id: '[USER_ID]', status: 1);
    
    puts response
  • using Appwrite;
    
    Client 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
    ;
    
    Users users = new Users(client);
    
    HttpResponseMessage result = await users.UpdateStatus("[USER_ID]", 1);
    
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Users users = Users(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 = users.updateStatus(
        userId: '[USER_ID]',
        status: 1,
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • appwrite users updateStatus \
            --userId="[USER_ID]" \
            --status="1"
    
  • import io.appwrite.Client
    import io.appwrite.services.Users
    
    suspend fun main() {
        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 users = Users(client)
        val response = users.updateStatus(
            userId = "[USER_ID]",
            status = 1
        )
        val json = response.body?.string()
    }
  • import io.appwrite.Client
    import io.appwrite.services.Users
    
    public void main() {
        Client client = Client(context)
            .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
            .setProject("5df5acd0d48c2") // Your project ID
            .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
        Users users = new Users(client);
        users.updateStatus(
            userId = "[USER_ID]",
            status = 1
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }

Update Email Verification

PATCH/v1/users/{userId}/verification

Update the user email verification status by its unique ID.

Authentication

To access this route, init your SDK with your project unique ID and API Key secret token. Make sure your API Key is granted with access to the "users.write" permission scope.

Request

Name Type Description
userId required string

User unique ID.

emailVerification required boolean

User Email Verification Status.

Response

Status Code Content Type Payload
200  OK application/json User Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    let client = new sdk.Client();
    
    let users = new sdk.Users(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 = users.updateVerification('[USER_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 users = new sdk.Users(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 = users.updateVerification('[USER_ID]', false);
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Users;
    
    $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
    ;
    
    $users = new Users($client);
    
    $result = $users->updateVerification('[USER_ID]', false);
  • from appwrite.client import Client
    from appwrite.services.users import Users
    
    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
    )
    
    users = Users(client)
    
    result = users.update_verification('[USER_ID]', False)
    
  • require 'appwrite'
    
    client = Appwrite::Client.new()
    
    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
    ;
    
    users = Appwrite::Users.new(client);
    
    response = users.update_verification(user_id: '[USER_ID]', email_verification: false);
    
    puts response
  • using Appwrite;
    
    Client 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
    ;
    
    Users users = new Users(client);
    
    HttpResponseMessage result = await users.UpdateVerification("[USER_ID]", false);
    
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Users users = Users(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 = users.updateVerification(
        userId: '[USER_ID]',
        emailVerification: false,
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • appwrite users updateVerification \
            --userId="[USER_ID]" \
            --emailVerification=""
    
  • import io.appwrite.Client
    import io.appwrite.services.Users
    
    suspend fun main() {
        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 users = Users(client)
        val response = users.updateVerification(
            userId = "[USER_ID]",
            emailVerification = false
        )
        val json = response.body?.string()
    }
  • import io.appwrite.Client
    import io.appwrite.services.Users
    
    public void main() {
        Client client = Client(context)
            .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
            .setProject("5df5acd0d48c2") // Your project ID
            .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
        Users users = new Users(client);
        users.updateVerification(
            userId = "[USER_ID]",
            emailVerification = false
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }

Update Name

PATCH/v1/users/{userId}/name

Update the user name by its unique ID.

Authentication

To access this route, init your SDK with your project unique ID and API Key secret token. Make sure your API Key is granted with access to the "users.write" permission scope.

Request

Name Type Description
userId required string

User unique ID.

name required string

User name. Max length: 128 chars.

Response

Status Code Content Type Payload
200  OK application/json User Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    let client = new sdk.Client();
    
    let users = new sdk.Users(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 = users.updateName('[USER_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 users = new sdk.Users(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 = users.updateName('[USER_ID]', '[NAME]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Users;
    
    $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
    ;
    
    $users = new Users($client);
    
    $result = $users->updateName('[USER_ID]', '[NAME]');
  • from appwrite.client import Client
    from appwrite.services.users import Users
    
    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
    )
    
    users = Users(client)
    
    result = users.update_name('[USER_ID]', '[NAME]')
    
  • require 'appwrite'
    
    client = Appwrite::Client.new()
    
    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
    ;
    
    users = Appwrite::Users.new(client);
    
    response = users.update_name(user_id: '[USER_ID]', name: '[NAME]');
    
    puts response
  • using Appwrite;
    
    Client 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
    ;
    
    Users users = new Users(client);
    
    HttpResponseMessage result = await users.UpdateName("[USER_ID]", "[NAME]");
    
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Users users = Users(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 = users.updateName(
        userId: '[USER_ID]',
        name: '[NAME]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • appwrite users updateName \
            --userId="[USER_ID]" \
            --name="[NAME]"
    
  • import io.appwrite.Client
    import io.appwrite.services.Users
    
    suspend fun main() {
        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 users = Users(client)
        val response = users.updateName(
            userId = "[USER_ID]",
            name = "[NAME]"
        )
        val json = response.body?.string()
    }
  • import io.appwrite.Client
    import io.appwrite.services.Users
    
    public void main() {
        Client client = Client(context)
            .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
            .setProject("5df5acd0d48c2") // Your project ID
            .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
        Users users = new Users(client);
        users.updateName(
            userId = "[USER_ID]",
            name = "[NAME]"
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }

Update Password

PATCH/v1/users/{userId}/password

Update the user password by its unique ID.

Authentication

To access this route, init your SDK with your project unique ID and API Key secret token. Make sure your API Key is granted with access to the "users.write" permission scope.

Request

Name Type Description
userId required string

User unique ID.

password required string

New user password. Must be between 6 to 32 chars.

Response

Status Code Content Type Payload
200  OK application/json User Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    let client = new sdk.Client();
    
    let users = new sdk.Users(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 = users.updatePassword('[USER_ID]', 'password');
    
    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 users = new sdk.Users(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 = users.updatePassword('[USER_ID]', 'password');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Users;
    
    $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
    ;
    
    $users = new Users($client);
    
    $result = $users->updatePassword('[USER_ID]', 'password');
  • from appwrite.client import Client
    from appwrite.services.users import Users
    
    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
    )
    
    users = Users(client)
    
    result = users.update_password('[USER_ID]', 'password')
    
  • require 'appwrite'
    
    client = Appwrite::Client.new()
    
    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
    ;
    
    users = Appwrite::Users.new(client);
    
    response = users.update_password(user_id: '[USER_ID]', password: 'password');
    
    puts response
  • using Appwrite;
    
    Client 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
    ;
    
    Users users = new Users(client);
    
    HttpResponseMessage result = await users.UpdatePassword("[USER_ID]", "password");
    
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Users users = Users(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 = users.updatePassword(
        userId: '[USER_ID]',
        password: 'password',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • appwrite users updatePassword \
            --userId="[USER_ID]" \
            --password="password"
    
  • import io.appwrite.Client
    import io.appwrite.services.Users
    
    suspend fun main() {
        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 users = Users(client)
        val response = users.updatePassword(
            userId = "[USER_ID]",
            password = "password"
        )
        val json = response.body?.string()
    }
  • import io.appwrite.Client
    import io.appwrite.services.Users
    
    public void main() {
        Client client = Client(context)
            .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
            .setProject("5df5acd0d48c2") // Your project ID
            .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
        Users users = new Users(client);
        users.updatePassword(
            userId = "[USER_ID]",
            password = "password"
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }

Update Email

PATCH/v1/users/{userId}/email

Update the user email by its unique ID.

Authentication

To access this route, init your SDK with your project unique ID and API Key secret token. Make sure your API Key is granted with access to the "users.write" permission scope.

Request

Name Type Description
userId required string

User unique ID.

email required string

User email.

Response

Status Code Content Type Payload
200  OK application/json User Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    let client = new sdk.Client();
    
    let users = new sdk.Users(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 = users.updateEmail('[USER_ID]', 'email@example.com');
    
    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 users = new sdk.Users(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 = users.updateEmail('[USER_ID]', 'email@example.com');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Users;
    
    $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
    ;
    
    $users = new Users($client);
    
    $result = $users->updateEmail('[USER_ID]', 'email@example.com');
  • from appwrite.client import Client
    from appwrite.services.users import Users
    
    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
    )
    
    users = Users(client)
    
    result = users.update_email('[USER_ID]', 'email@example.com')
    
  • require 'appwrite'
    
    client = Appwrite::Client.new()
    
    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
    ;
    
    users = Appwrite::Users.new(client);
    
    response = users.update_email(user_id: '[USER_ID]', email: 'email@example.com');
    
    puts response
  • using Appwrite;
    
    Client 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
    ;
    
    Users users = new Users(client);
    
    HttpResponseMessage result = await users.UpdateEmail("[USER_ID]", "email@example.com");
    
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Users users = Users(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 = users.updateEmail(
        userId: '[USER_ID]',
        email: 'email@example.com',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • appwrite users updateEmail \
            --userId="[USER_ID]" \
            --email="email@example.com"
    
  • import io.appwrite.Client
    import io.appwrite.services.Users
    
    suspend fun main() {
        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 users = Users(client)
        val response = users.updateEmail(
            userId = "[USER_ID]",
            email = "email@example.com"
        )
        val json = response.body?.string()
    }
  • import io.appwrite.Client
    import io.appwrite.services.Users
    
    public void main() {
        Client client = Client(context)
            .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
            .setProject("5df5acd0d48c2") // Your project ID
            .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
        Users users = new Users(client);
        users.updateEmail(
            userId = "[USER_ID]",
            email = "email@example.com"
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }

Update User Preferences

PATCH/v1/users/{userId}/prefs

Update the user preferences by its unique ID. You can pass only the specific settings you wish to update.

Authentication

To access this route, init your SDK with your project unique ID and API Key secret token. Make sure your API Key is granted with access to the "users.write" permission scope.

Request

Name Type Description
userId required string

User unique ID.

prefs required object

Prefs key-value JSON object.

Response

Status Code Content Type Payload
200  OK application/json Preferences Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    let client = new sdk.Client();
    
    let users = new sdk.Users(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 = users.updatePrefs('[USER_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 users = new sdk.Users(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 = users.updatePrefs('[USER_ID]', {});
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Users;
    
    $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
    ;
    
    $users = new Users($client);
    
    $result = $users->updatePrefs('[USER_ID]', []);
  • from appwrite.client import Client
    from appwrite.services.users import Users
    
    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
    )
    
    users = Users(client)
    
    result = users.update_prefs('[USER_ID]', {})
    
  • require 'appwrite'
    
    client = Appwrite::Client.new()
    
    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
    ;
    
    users = Appwrite::Users.new(client);
    
    response = users.update_prefs(user_id: '[USER_ID]', prefs: {});
    
    puts response
  • using Appwrite;
    
    Client 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
    ;
    
    Users users = new Users(client);
    
    HttpResponseMessage result = await users.UpdatePrefs("[USER_ID]", [object]);
    
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Users users = Users(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 = users.updatePrefs(
        userId: '[USER_ID]',
        prefs: {},
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • appwrite users updatePrefs \
            --userId="[USER_ID]" \
            --prefs="{}"
    
  • import io.appwrite.Client
    import io.appwrite.services.Users
    
    suspend fun main() {
        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 users = Users(client)
        val response = users.updatePrefs(
            userId = "[USER_ID]",
            prefs = mapOf( "a" to "b" )
        )
        val json = response.body?.string()
    }
  • import io.appwrite.Client
    import io.appwrite.services.Users
    
    public void main() {
        Client client = Client(context)
            .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
            .setProject("5df5acd0d48c2") // Your project ID
            .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
        Users users = new Users(client);
        users.updatePrefs(
            userId = "[USER_ID]",
            prefs = mapOf( "a" to "b" )
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }

Delete User Session

DELETE/v1/users/{userId}/sessions/{sessionId}

Delete a user sessions by its unique ID.

Authentication

To access this route, init your SDK with your project unique ID and API Key secret token. Make sure your API Key is granted with access to the "users.write" permission scope.

Request

Name Type Description
userId required string

User unique ID.

sessionId required string

User unique session ID.

Response

Status Code Content Type Payload
204  No Content - -
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    let client = new sdk.Client();
    
    let users = new sdk.Users(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 = users.deleteSession('[USER_ID]', '[SESSION_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 users = new sdk.Users(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 = users.deleteSession('[USER_ID]', '[SESSION_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Users;
    
    $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
    ;
    
    $users = new Users($client);
    
    $result = $users->deleteSession('[USER_ID]', '[SESSION_ID]');
  • from appwrite.client import Client
    from appwrite.services.users import Users
    
    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
    )
    
    users = Users(client)
    
    result = users.delete_session('[USER_ID]', '[SESSION_ID]')
    
  • require 'appwrite'
    
    client = Appwrite::Client.new()
    
    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
    ;
    
    users = Appwrite::Users.new(client);
    
    response = users.delete_session(user_id: '[USER_ID]', session_id: '[SESSION_ID]');
    
    puts response
  • using Appwrite;
    
    Client 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
    ;
    
    Users users = new Users(client);
    
    HttpResponseMessage result = await users.DeleteSession("[USER_ID]", "[SESSION_ID]");
    
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Users users = Users(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 = users.deleteSession(
        userId: '[USER_ID]',
        sessionId: '[SESSION_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • appwrite users deleteSession \
            --userId="[USER_ID]" \
            --sessionId="[SESSION_ID]"
    
  • import io.appwrite.Client
    import io.appwrite.services.Users
    
    suspend fun main() {
        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 users = Users(client)
        val response = users.deleteSession(
            userId = "[USER_ID]",
            sessionId = "[SESSION_ID]"
        )
        val json = response.body?.string()
    }
  • import io.appwrite.Client
    import io.appwrite.services.Users
    
    public void main() {
        Client client = Client(context)
            .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
            .setProject("5df5acd0d48c2") // Your project ID
            .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
        Users users = new Users(client);
        users.deleteSession(
            userId = "[USER_ID]",
            sessionId = "[SESSION_ID]"
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }

Delete User Sessions

DELETE/v1/users/{userId}/sessions

Delete all user's sessions by using the user's unique ID.

Authentication

To access this route, init your SDK with your project unique ID and API Key secret token. Make sure your API Key is granted with access to the "users.write" permission scope.

Request

Name Type Description
userId required string

User unique ID.

Response

Status Code Content Type Payload
204  No Content - -
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    let client = new sdk.Client();
    
    let users = new sdk.Users(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 = users.deleteSessions('[USER_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 users = new sdk.Users(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 = users.deleteSessions('[USER_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Users;
    
    $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
    ;
    
    $users = new Users($client);
    
    $result = $users->deleteSessions('[USER_ID]');
  • from appwrite.client import Client
    from appwrite.services.users import Users
    
    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
    )
    
    users = Users(client)
    
    result = users.delete_sessions('[USER_ID]')
    
  • require 'appwrite'
    
    client = Appwrite::Client.new()
    
    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
    ;
    
    users = Appwrite::Users.new(client);
    
    response = users.delete_sessions(user_id: '[USER_ID]');
    
    puts response
  • using Appwrite;
    
    Client 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
    ;
    
    Users users = new Users(client);
    
    HttpResponseMessage result = await users.DeleteSessions("[USER_ID]");
    
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Users users = Users(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 = users.deleteSessions(
        userId: '[USER_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • appwrite users deleteSessions \
            --userId="[USER_ID]"
    
  • import io.appwrite.Client
    import io.appwrite.services.Users
    
    suspend fun main() {
        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 users = Users(client)
        val response = users.deleteSessions(
            userId = "[USER_ID]"
        )
        val json = response.body?.string()
    }
  • import io.appwrite.Client
    import io.appwrite.services.Users
    
    public void main() {
        Client client = Client(context)
            .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
            .setProject("5df5acd0d48c2") // Your project ID
            .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
        Users users = new Users(client);
        users.deleteSessions(
            userId = "[USER_ID]"
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }

Delete User

DELETE/v1/users/{userId}

Delete a user by its unique ID.

Authentication

To access this route, init your SDK with your project unique ID and API Key secret token. Make sure your API Key is granted with access to the "users.write" permission scope.

Request

Name Type Description
userId required string

User unique ID.

Response

Status Code Content Type Payload
204  No Content - -
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    let client = new sdk.Client();
    
    let users = new sdk.Users(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 = users.delete('[USER_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 users = new sdk.Users(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 = users.delete('[USER_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Users;
    
    $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
    ;
    
    $users = new Users($client);
    
    $result = $users->delete('[USER_ID]');
  • from appwrite.client import Client
    from appwrite.services.users import Users
    
    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
    )
    
    users = Users(client)
    
    result = users.delete('[USER_ID]')
    
  • require 'appwrite'
    
    client = Appwrite::Client.new()
    
    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
    ;
    
    users = Appwrite::Users.new(client);
    
    response = users.delete(user_id: '[USER_ID]');
    
    puts response
  • using Appwrite;
    
    Client 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
    ;
    
    Users users = new Users(client);
    
    HttpResponseMessage result = await users.Delete("[USER_ID]");
    
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Users users = Users(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 = users.delete(
        userId: '[USER_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • appwrite users delete \
            --userId="[USER_ID]"
    
  • import io.appwrite.Client
    import io.appwrite.services.Users
    
    suspend fun main() {
        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 users = Users(client)
        val response = users.delete(
            userId = "[USER_ID]"
        )
        val json = response.body?.string()
    }
  • import io.appwrite.Client
    import io.appwrite.services.Users
    
    public void main() {
        Client client = Client(context)
            .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
            .setProject("5df5acd0d48c2") // Your project ID
            .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
        Users users = new Users(client);
        users.delete(
            userId = "[USER_ID]"
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }