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.
List users
Get a list of all the project's users. You can use the query params to filter your results.
Request
queries array Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification
search string Search term to filter your list results. Max length: 256 chars.
Response
200 application/json
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const users = new sdk.Users(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = users.list();
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Create user
Create a new user.
Request
userId string requiredUser ID. Choose a custom ID or generate a random ID with
ID.unique()
. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.email string User email.
phone string Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
password string Plain text user password. Must be at least 8 chars.
name string User name. Max length: 128 chars.
Response
201 application/json
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const users = new sdk.Users(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = users.create('[USER_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Create user with Argon2 password
Create a new user. Password provided must be hashed with the Argon2 algorithm. Use the POST /users endpoint to create users with a plain text password.
Request
userId string requiredUser ID. Choose a custom ID or generate a random ID with
ID.unique()
. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.email string requiredUser email.
password string requiredUser password hashed using Argon2.
name string User name. Max length: 128 chars.
Response
201 application/json
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const users = new sdk.Users(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = users.createArgon2User('[USER_ID]', 'email@example.com', 'password');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Create user with bcrypt password
Create a new user. Password provided must be hashed with the Bcrypt algorithm. Use the POST /users endpoint to create users with a plain text password.
Request
userId string requiredUser ID. Choose a custom ID or generate a random ID with
ID.unique()
. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.email string requiredUser email.
password string requiredUser password hashed using Bcrypt.
name string User name. Max length: 128 chars.
Response
201 application/json
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const users = new sdk.Users(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = users.createBcryptUser('[USER_ID]', 'email@example.com', 'password');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
List Identities
Get identities for all users.
Request
queries string Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry
search string Search term to filter your list results. Max length: 256 chars.
Response
200 application/json
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const users = new sdk.Users(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = users.listIdentities();
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Delete Identity
Delete an identity by its unique ID.
Request
identityId string requiredIdentity ID.
Response
204 application/json
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const users = new sdk.Users(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = users.deleteIdentity('[IDENTITY_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Create user with MD5 password
Create a new user. Password provided must be hashed with the MD5 algorithm. Use the POST /users endpoint to create users with a plain text password.
Request
userId string requiredUser ID. Choose a custom ID or generate a random ID with
ID.unique()
. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.email string requiredUser email.
password string requiredUser password hashed using MD5.
name string User name. Max length: 128 chars.
Response
201 application/json
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const users = new sdk.Users(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = users.createMD5User('[USER_ID]', 'email@example.com', 'password');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Create user with PHPass password
Create a new user. Password provided must be hashed with the PHPass algorithm. Use the POST /users endpoint to create users with a plain text password.
Request
userId string requiredUser ID. Choose a custom ID or pass the string
ID.unique()
to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.email string requiredUser email.
password string requiredUser password hashed using PHPass.
name string User name. Max length: 128 chars.
Response
201 application/json
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const users = new sdk.Users(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = users.createPHPassUser('[USER_ID]', 'email@example.com', 'password');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Create user with Scrypt password
Create a new user. Password provided must be hashed with the Scrypt algorithm. Use the POST /users endpoint to create users with a plain text password.
Request
userId string requiredUser ID. Choose a custom ID or generate a random ID with
ID.unique()
. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.email string requiredUser email.
password string requiredUser password hashed using Scrypt.
passwordSalt string requiredOptional salt used to hash password.
passwordCpu integer requiredOptional CPU cost used to hash password.
passwordMemory integer requiredOptional memory cost used to hash password.
passwordParallel integer requiredOptional parallelization cost used to hash password.
passwordLength integer requiredOptional hash length used to hash password.
name string User name. Max length: 128 chars.
Response
201 application/json
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const users = new sdk.Users(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = users.createScryptUser('[USER_ID]', 'email@example.com', 'password', '[PASSWORD_SALT]', null, null, null, null);
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Create user with Scrypt modified password
Create a new user. Password provided must be hashed with the Scrypt Modified algorithm. Use the POST /users endpoint to create users with a plain text password.
Request
userId string requiredUser ID. Choose a custom ID or generate a random ID with
ID.unique()
. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.email string requiredUser email.
password string requiredUser password hashed using Scrypt Modified.
passwordSalt string requiredSalt used to hash password.
passwordSaltSeparator string requiredSalt separator used to hash password.
passwordSignerKey string requiredSigner key used to hash password.
name string User name. Max length: 128 chars.
Response
201 application/json
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const users = new sdk.Users(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = users.createScryptModifiedUser('[USER_ID]', 'email@example.com', 'password', '[PASSWORD_SALT]', '[PASSWORD_SALT_SEPARATOR]', '[PASSWORD_SIGNER_KEY]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Create user with SHA password
Create a new user. Password provided must be hashed with the SHA algorithm. Use the POST /users endpoint to create users with a plain text password.
Request
userId string requiredUser ID. Choose a custom ID or generate a random ID with
ID.unique()
. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.email string requiredUser email.
password string requiredUser password hashed using SHA.
passwordVersion string Optional SHA version used to hash password. Allowed values are: 'sha1', 'sha224', 'sha256', 'sha384', 'sha512/224', 'sha512/256', 'sha512', 'sha3-224', 'sha3-256', 'sha3-384', 'sha3-512'
name string User name. Max length: 128 chars.
Response
201 application/json
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const users = new sdk.Users(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = users.createSHAUser('[USER_ID]', 'email@example.com', 'password');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Get user
Get a user by its unique ID.
Request
userId string requiredUser ID.
Response
200 application/json
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const users = new sdk.Users(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = users.get('[USER_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Delete user
Delete a user by its unique ID, thereby releasing it's ID. Since ID is released and can be reused, all user-related resources like documents or storage files should be deleted before user deletion. If you want to keep ID reserved, use the updateStatus endpoint instead.
Request
userId string requiredUser ID.
Response
204 application/json
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const users = new sdk.Users(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = users.delete('[USER_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Update email
Update the user email by its unique ID.
Request
userId string requiredUser ID.
email string requiredUser email.
Response
200 application/json
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const users = new sdk.Users(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = users.updateEmail('[USER_ID]', 'email@example.com');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Update user labels
Update the user labels by its unique ID.
Labels can be used to grant access to resources. While teams are a way for user's to share access to a resource, labels can be defined by the developer to grant access without an invitation. See the Permissions docs for more info.
Request
userId string requiredUser ID.
labels array requiredArray of user labels. Replaces the previous labels. Maximum of 100 labels are allowed, each up to 36 alphanumeric characters long.
Response
200 application/json
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const users = new sdk.Users(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = users.updateLabels('[USER_ID]', []);
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
List user logs
Get the user activity logs list by its unique ID.
Request
userId string requiredUser ID.
queries array Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Only supported methods are limit and offset
Response
200 application/json
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const users = new sdk.Users(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = users.listLogs('[USER_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
List user memberships
Get the user membership list by its unique ID.
Request
userId string requiredUser ID.
Response
200 application/json
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const users = new sdk.Users(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = users.listMemberships('[USER_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Update name
Update the user name by its unique ID.
Request
userId string requiredUser ID.
name string requiredUser name. Max length: 128 chars.
Response
200 application/json
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const users = new sdk.Users(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = users.updateName('[USER_ID]', '[NAME]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Update password
Update the user password by its unique ID.
Request
userId string requiredUser ID.
password string requiredNew user password. Must be at least 8 chars.
Response
200 application/json
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const users = new sdk.Users(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = users.updatePassword('[USER_ID]', '');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Update phone
Update the user phone by its unique ID.
Request
userId string requiredUser ID.
number string requiredUser phone number.
Response
200 application/json
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const users = new sdk.Users(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = users.updatePhone('[USER_ID]', '+12065550100');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Get user preferences
Get the user preferences by its unique ID.
Request
userId string requiredUser ID.
Response
200 application/json
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const users = new sdk.Users(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = users.getPrefs('[USER_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Update user preferences
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.
Request
userId string requiredUser ID.
prefs object requiredPrefs key-value JSON object.
Response
200 application/json
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const users = new sdk.Users(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = users.updatePrefs('[USER_ID]', {});
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
List user sessions
Get the user sessions list by its unique ID.
Request
userId string requiredUser ID.
Response
200 application/json
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const users = new sdk.Users(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = users.listSessions('[USER_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Delete user sessions
Delete all user's sessions by using the user's unique ID.
Request
userId string requiredUser ID.
Response
204 application/json
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const users = new sdk.Users(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = users.deleteSessions('[USER_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Delete user session
Delete a user sessions by its unique ID.
Request
userId string requiredUser ID.
sessionId string requiredSession ID.
Response
204 application/json
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const users = new sdk.Users(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = users.deleteSession('[USER_ID]', '[SESSION_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Update user status
Update the user status by its unique ID. Use this endpoint as an alternative to deleting a user if you want to keep user's ID reserved.
Request
userId string requiredUser ID.
status boolean requiredUser Status. To activate the user pass
true
and to block the user passfalse
.
Response
200 application/json
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const users = new sdk.Users(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = users.updateStatus('[USER_ID]', false);
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Update email verification
Update the user email verification status by its unique ID.
Request
userId string requiredUser ID.
emailVerification boolean requiredUser email verification status.
Response
200 application/json
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const users = new sdk.Users(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = users.updateEmailVerification('[USER_ID]', false);
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Update phone verification
Update the user phone verification status by its unique ID.
Request
userId string requiredUser ID.
phoneVerification boolean requiredUser phone verification status.
Response
200 application/json
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const users = new sdk.Users(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = users.updatePhoneVerification('[USER_ID]', false);
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});