We're having lots of fun on Discord! Come and join us! 💬
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.

HTTP Request

Name Type Description
userId required string

User ID. Choose your own unique ID or pass the string 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.

email required string

User email.

password required string

User password. Must be at least 8 chars.

name optional string

User name. Max length: 128 chars.

HTTP 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('[USER_ID]', '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('[USER_ID]', '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('[USER_ID]', '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('[USER_ID]', '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(user_id: '[USER_ID]', email: 'email@example.com', password: 'password')
    
    puts response.inspect
  • 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(
        userId: '[USER_ID]',
        email: 'email@example.com',
        password: 'password',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • appwrite users create \
            --userId="[USER_ID]" \
            --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(
            userId = "[USER_ID]",
            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(
            userId = "[USER_ID]",
            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());
                    }
                }
            }
        );
    }
  • import Appwrite
    
    func main() {
        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 users = Users(client)
        users.create(
            userId: "[USER_ID]",
            email: "email@example.com",
            password: "password"
        ) { result in
            switch result {
            case .failure(let error):
                print(error.message)
            case .success(let user):
                print(String(describing: user)
            }
        }
    }
    

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.

HTTP Request

Name Type Description
search optional string

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

limit optional integer

Maximum number of users to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.

offset optional integer

Offset value. The default value is 0. Use this param to manage pagination. learn more about pagination

cursor optional string

ID of the user used as the starting point for the query, excluding the user itself. Should be used for efficient pagination when working with large sets of data. learn more about pagination

cursorDirection optional string

Direction of the cursor.

orderType optional string

Order result by ASC or DESC order.

HTTP 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.inspect
  • 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" \
            --cursor="[CURSOR]" \
            --cursorDirection="after" \
            --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());
                    }
                }
            }
        );
    }
  • import Appwrite
    
    func main() {
        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 users = Users(client)
        users.list() { result in
            switch result {
            case .failure(let error):
                print(error.message)
            case .success(let userList):
                print(String(describing: userList)
            }
        }
    }
    

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.

HTTP Request

Name Type Description
userId required string

User ID.

HTTP 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.inspect
  • 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());
                    }
                }
            }
        );
    }
  • import Appwrite
    
    func main() {
        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 users = Users(client)
        users.get(
            userId: "[USER_ID]"
        ) { result in
            switch result {
            case .failure(let error):
                print(error.message)
            case .success(let user):
                print(String(describing: user)
            }
        }
    }
    

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.

HTTP Request

Name Type Description
userId required string

User ID.

HTTP 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.inspect
  • 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());
                    }
                }
            }
        );
    }
  • import Appwrite
    
    func main() {
        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 users = Users(client)
        users.getPrefs(
            userId: "[USER_ID]"
        ) { result in
            switch result {
            case .failure(let error):
                print(error.message)
            case .success(let preferences):
                print(String(describing: preferences)
            }
        }
    }
    

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.

HTTP Request

Name Type Description
userId required string

User ID.

HTTP 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.inspect
  • 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());
                    }
                }
            }
        );
    }
  • import Appwrite
    
    func main() {
        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 users = Users(client)
        users.getSessions(
            userId: "[USER_ID]"
        ) { result in
            switch result {
            case .failure(let error):
                print(error.message)
            case .success(let sessionList):
                print(String(describing: sessionList)
            }
        }
    }
    

Get User Logs

GET/v1/users/{userId}/logs

Get the 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.

HTTP Request

Name Type Description
userId required string

User ID.

limit optional integer

Maximum number of logs to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.

offset optional integer

Offset value. The default value is 0. Use this value to manage pagination. learn more about pagination

HTTP 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.inspect
  • 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]" \
            --limit="0" \
            --offset="0"
    
  • 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());
                    }
                }
            }
        );
    }
  • import Appwrite
    
    func main() {
        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 users = Users(client)
        users.getLogs(
            userId: "[USER_ID]"
        ) { result in
            switch result {
            case .failure(let error):
                print(error.message)
            case .success(let logList):
                print(String(describing: logList)
            }
        }
    }
    

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.

HTTP Request

Name Type Description
userId required string

User ID.

status required boolean

User Status. To activate the user pass true and to block the user pass false.

HTTP 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]', 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.updateStatus('[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->updateStatus('[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_status('[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_status(user_id: '[USER_ID]', status: false)
    
    puts response.inspect
  • 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: false,
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • appwrite users updateStatus \
            --userId="[USER_ID]" \
            --status=""
    
  • 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 = 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.updateStatus(
            userId = "[USER_ID]",
            status = 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());
                    }
                }
            }
        );
    }
  • import Appwrite
    
    func main() {
        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 users = Users(client)
        users.updateStatus(
            userId: "[USER_ID]",
            status: xfalse
        ) { result in
            switch result {
            case .failure(let error):
                print(error.message)
            case .success(let user):
                print(String(describing: user)
            }
        }
    }
    

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.

HTTP Request

Name Type Description
userId required string

User ID.

emailVerification required boolean

User email verification status.

HTTP 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.inspect
  • 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());
                    }
                }
            }
        );
    }
  • import Appwrite
    
    func main() {
        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 users = Users(client)
        users.updateVerification(
            userId: "[USER_ID]",
            emailVerification: xfalse
        ) { result in
            switch result {
            case .failure(let error):
                print(error.message)
            case .success(let user):
                print(String(describing: user)
            }
        }
    }
    

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.

HTTP Request

Name Type Description
userId required string

User ID.

name required string

User name. Max length: 128 chars.

HTTP 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.inspect
  • 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());
                    }
                }
            }
        );
    }
  • import Appwrite
    
    func main() {
        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 users = Users(client)
        users.updateName(
            userId: "[USER_ID]",
            name: "[NAME]"
        ) { result in
            switch result {
            case .failure(let error):
                print(error.message)
            case .success(let user):
                print(String(describing: user)
            }
        }
    }
    

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.

HTTP Request

Name Type Description
userId required string

User ID.

password required string

New user password. Must be at least 8 chars.

HTTP 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.inspect
  • 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());
                    }
                }
            }
        );
    }
  • import Appwrite
    
    func main() {
        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 users = Users(client)
        users.updatePassword(
            userId: "[USER_ID]",
            password: "password"
        ) { result in
            switch result {
            case .failure(let error):
                print(error.message)
            case .success(let user):
                print(String(describing: user)
            }
        }
    }
    

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.

HTTP Request

Name Type Description
userId required string

User ID.

email required string

User email.

HTTP 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.inspect
  • 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());
                    }
                }
            }
        );
    }
  • import Appwrite
    
    func main() {
        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 users = Users(client)
        users.updateEmail(
            userId: "[USER_ID]",
            email: "email@example.com"
        ) { result in
            switch result {
            case .failure(let error):
                print(error.message)
            case .success(let user):
                print(String(describing: user)
            }
        }
    }
    

Update User Preferences

PATCH/v1/users/{userId}/prefs

Update the user preferences by its unique ID. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded.

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.

HTTP Request

Name Type Description
userId required string

User ID.

prefs required object

Prefs key-value JSON object.

HTTP 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.inspect
  • 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());
                    }
                }
            }
        );
    }
  • import Appwrite
    
    func main() {
        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 users = Users(client)
        users.updatePrefs(
            userId: "[USER_ID]",
            prefs: 
        ) { result in
            switch result {
            case .failure(let error):
                print(error.message)
            case .success(let preferences):
                print(String(describing: preferences)
            }
        }
    }
    

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.

HTTP Request

Name Type Description
userId required string

User ID.

sessionId required string

Session ID.

HTTP 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.inspect
  • 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());
                    }
                }
            }
        );
    }
  • import Appwrite
    
    func main() {
        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 users = Users(client)
        users.deleteSession(
            userId: "[USER_ID]",
            sessionId: "[SESSION_ID]"
        ) { result in
            switch result {
            case .failure(let error):
                print(error.message)
            case .success(let ):
                print(String(describing: )
            }
        }
    }
    

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.

HTTP Request

Name Type Description
userId required string

User ID.

HTTP 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.inspect
  • 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());
                    }
                }
            }
        );
    }
  • import Appwrite
    
    func main() {
        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 users = Users(client)
        users.deleteSessions(
            userId: "[USER_ID]"
        ) { result in
            switch result {
            case .failure(let error):
                print(error.message)
            case .success(let ):
                print(String(describing: )
            }
        }
    }
    

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.

HTTP Request

Name Type Description
userId required string

User ID.

HTTP 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.inspect
  • 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());
                    }
                }
            }
        );
    }
  • import Appwrite
    
    func main() {
        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 users = Users(client)
        users.delete(
            userId: "[USER_ID]"
        ) { result in
            switch result {
            case .failure(let error):
                print(error.message)
            case .success(let ):
                print(String(describing: )
            }
        }
    }