Docs

Account API


Client integration with  

The Account service allows you to authenticate and manage a user account. You can use the account service to update user information, retrieve the user sessions across different devices, and fetch the user security logs with his or her recent activity.

Register new user accounts with the Create Account, Create Magic URL session, or Create Phone session endpoint. You can authenticate the user account by using multiple sign-in methods available. Once the user is authenticated, a new session object will be created to allow the user to access his or her private data and settings.

This service also exposes an endpoint to save and read the user preferences as a key-value object. This feature is handy if you want to allow extra customization in your app. Common usage for this feature may include saving the user's preferred locale, timezone, or custom app theme.

Account API vs Users API

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

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 Account

POST/v1/account

Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the /account/verfication route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new account session.

Rate Limits

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

HTTP Request

Name Type Description
userId required string

Unique 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 required string

User email.

password required string

New 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
  • import { Client, Account } from "appwrite";
    
    const client = new Client();
    
    const account = new Account(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    const promise = account.create('[USER_ID]', 'email@example.com', '');
    
    promise.then(function (response) {
        console.log(response); // Success
    }, function (error) {
        console.log(error); // Failure
    });
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Account account = Account(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
      Future result = account.create(
        userId: '[USER_ID]',
        email: 'email@example.com',
        password: '',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    let account = Account(client)
    
    let user = try await account.create(
        userId: "[USER_ID]",
        email: "email@example.com",
        password: ""
    )
    
    
  • import io.appwrite.Client
    import io.appwrite.services.Account
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    val account = Account(client)
    
    val response = account.create(
        userId = "[USER_ID]",
        email = "email@example.com",
        password = "",
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Account;
    
    Client client = new Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2"); // Your project ID
    
    Account account = new Account(client);
    
    account.create(
        "[USER_ID]",
        "email@example.com",
        "",
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            Log.d("Appwrite", result.toString());
        })
    );
    
  • mutation {
        accountCreate(
            userId: "[USER_ID]",
            email: "email@example.com",
            password: ""
        ) {
            _id
            _createdAt
            _updatedAt
            name
            registration
            status
            passwordUpdate
            email
            phone
            emailVerification
            phoneVerification
            prefs {
                data
            }
        }
    }
    
  • POST /v1/account HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    
    {
      "userId": "[USER_ID]",
      "email": "email@example.com",
      "password": ,
      "name": "[NAME]"
    }
    

Create Email Session

POST/v1/account/sessions/email

Allow the user to login into their account by providing a valid email and password combination. This route will create a new session for the user.

A user is limited to 10 active sessions at a time by default. Learn more about session limits.

Rate Limits

This endpoint is limited to 10 requests in every 60 minutes per email address. We use rate limits to avoid service abuse by users and as a security practice. Learn more about rate limiting.

HTTP Request

Name Type Description
email required string

User email.

password required string

User password. Must be at least 8 chars.

HTTP Response

Status Code Content Type Payload
201  Created application/json Session Object
Example Request
  • import { Client, Account } from "appwrite";
    
    const client = new Client();
    
    const account = new Account(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    const promise = account.createEmailSession('email@example.com', 'password');
    
    promise.then(function (response) {
        console.log(response); // Success
    }, function (error) {
        console.log(error); // Failure
    });
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Account account = Account(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
      Future result = account.createEmailSession(
        email: 'email@example.com',
        password: 'password',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    let account = Account(client)
    
    let session = try await account.createEmailSession(
        email: "email@example.com",
        password: "password"
    )
    
    
  • import io.appwrite.Client
    import io.appwrite.services.Account
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    val account = Account(client)
    
    val response = account.createEmailSession(
        email = "email@example.com",
        password = "password"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Account;
    
    Client client = new Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2"); // Your project ID
    
    Account account = new Account(client);
    
    account.createEmailSession(
        "email@example.com",
        "password"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            Log.d("Appwrite", result.toString());
        })
    );
    
  • mutation {
        accountCreateEmailSession(
            email: "email@example.com",
            password: "password"
        ) {
            _id
            _createdAt
            userId
            expire
            provider
            providerUid
            providerAccessToken
            providerAccessTokenExpiry
            providerRefreshToken
            ip
            osCode
            osName
            osVersion
            clientType
            clientCode
            clientName
            clientVersion
            clientEngine
            clientEngineVersion
            deviceName
            deviceBrand
            deviceModel
            countryCode
            countryName
            current
        }
    }
    
  • POST /v1/account/sessions/email HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    
    {
      "email": "email@example.com",
      "password": "password"
    }
    

Create OAuth2 Session

GET/v1/account/sessions/oauth2/{provider}

Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed.

If there is already an active session, the new session will be attached to the logged-in account. If there are no active sessions, the server will attempt to look for a user with the same email address as the email received from the OAuth2 provider and attach the new session to the existing user. If no matching user is found - the server will create a new user.

A user is limited to 10 active sessions at a time by default. Learn more about session limits.

Rate Limits

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

HTTP Request

Name Type Description
provider required string

OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, github, gitlab, google, linkedin, microsoft, notion, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoom.

success optional string

URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an open redirect attack against your project API.

failure optional string

URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an open redirect attack against your project API.

scopes optional array

A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.

HTTP Response

Status Code Content Type Payload
301   text/html -
Example Request
  • import { Client, Account } from "appwrite";
    
    const client = new Client();
    
    const account = new Account(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    // Go to OAuth provider login page
    account.createOAuth2Session('amazon');
    
    
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Account account = Account(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
      Future result = account.createOAuth2Session(
        provider: 'amazon',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    let account = Account(client)
    
    let success = try await account.createOAuth2Session(
        provider: "amazon"
    )
    
    
  • import io.appwrite.Client
    import io.appwrite.services.Account
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    val account = Account(client)
    
    account.createOAuth2Session(
        provider = "amazon",
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Account;
    
    Client client = new Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2"); // Your project ID
    
    Account account = new Account(client);
    
    account.createOAuth2Session(
        "amazon",
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            Log.d("Appwrite", result.toString());
        })
    );
    
  • GET /v1/account/sessions/oauth2/{provider} HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    
    

Create Magic URL session

POST/v1/account/sessions/magic-url

Sends the user an email with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to submit a request to the PUT /account/sessions/magic-url endpoint to complete the login process. The link sent to the user's email address is valid for 1 hour. If you are on a mobile device you can leave the URL parameter empty, so that the login completion will be handled by your Appwrite instance by default.

A user is limited to 10 active sessions at a time by default. Learn more about session limits.

Rate Limits

This endpoint is limited to 10 requests in every 60 minutes per email address. We use rate limits to avoid service abuse by users and as a security practice. Learn more about rate limiting.

HTTP Request

Name Type Description
userId required string

Unique 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 required string

User email.

url optional string

URL to redirect the user back to your app from the magic URL login. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an open redirect attack against your project API.

HTTP Response

Status Code Content Type Payload
201  Created application/json Token Object
Example Request
  • import { Client, Account } from "appwrite";
    
    const client = new Client();
    
    const account = new Account(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    const promise = account.createMagicURLSession('[USER_ID]', 'email@example.com');
    
    promise.then(function (response) {
        console.log(response); // Success
    }, function (error) {
        console.log(error); // Failure
    });
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Account account = Account(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
      Future result = account.createMagicURLSession(
        userId: '[USER_ID]',
        email: 'email@example.com',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    let account = Account(client)
    
    let token = try await account.createMagicURLSession(
        userId: "[USER_ID]",
        email: "email@example.com"
    )
    
    
  • import io.appwrite.Client
    import io.appwrite.services.Account
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    val account = Account(client)
    
    val response = account.createMagicURLSession(
        userId = "[USER_ID]",
        email = "email@example.com",
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Account;
    
    Client client = new Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2"); // Your project ID
    
    Account account = new Account(client);
    
    account.createMagicURLSession(
        "[USER_ID]",
        "email@example.com",
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            Log.d("Appwrite", result.toString());
        })
    );
    
  • mutation {
        accountCreateMagicURLSession(
            userId: "[USER_ID]",
            email: "email@example.com"
        ) {
            _id
            _createdAt
            userId
            secret
            expire
        }
    }
    
  • POST /v1/account/sessions/magic-url HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    
    {
      "userId": "[USER_ID]",
      "email": "email@example.com",
      "url": "https://example.com"
    }
    

Create Magic URL session (confirmation)

PUT/v1/account/sessions/magic-url

Use this endpoint to complete creating the session with the Magic URL. Both the userId and secret arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the POST /account/sessions/magic-url endpoint.

Please note that in order to avoid a Redirect Attack the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.

Rate Limits

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

HTTP Request

Name Type Description
userId required string

User ID.

secret required string

Valid verification token.

HTTP Response

Status Code Content Type Payload
200  OK application/json Session Object
Example Request
  • import { Client, Account } from "appwrite";
    
    const client = new Client();
    
    const account = new Account(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    const promise = account.updateMagicURLSession('[USER_ID]', '[SECRET]');
    
    promise.then(function (response) {
        console.log(response); // Success
    }, function (error) {
        console.log(error); // Failure
    });
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Account account = Account(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
      Future result = account.updateMagicURLSession(
        userId: '[USER_ID]',
        secret: '[SECRET]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    let account = Account(client)
    
    let session = try await account.updateMagicURLSession(
        userId: "[USER_ID]",
        secret: "[SECRET]"
    )
    
    
  • import io.appwrite.Client
    import io.appwrite.services.Account
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    val account = Account(client)
    
    val response = account.updateMagicURLSession(
        userId = "[USER_ID]",
        secret = "[SECRET]"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Account;
    
    Client client = new Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2"); // Your project ID
    
    Account account = new Account(client);
    
    account.updateMagicURLSession(
        "[USER_ID]",
        "[SECRET]"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            Log.d("Appwrite", result.toString());
        })
    );
    
  • mutation {
        accountUpdateMagicURLSession(
            userId: "[USER_ID]",
            secret: "[SECRET]"
        ) {
            _id
            _createdAt
            userId
            expire
            provider
            providerUid
            providerAccessToken
            providerAccessTokenExpiry
            providerRefreshToken
            ip
            osCode
            osName
            osVersion
            clientType
            clientCode
            clientName
            clientVersion
            clientEngine
            clientEngineVersion
            deviceName
            deviceBrand
            deviceModel
            countryCode
            countryName
            current
        }
    }
    
  • PUT /v1/account/sessions/magic-url HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    
    {
      "userId": "[USER_ID]",
      "secret": "[SECRET]"
    }
    

Create Phone session

POST/v1/account/sessions/phone

Sends the user an SMS with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the PUT /account/sessions/phone endpoint to complete the login process. The secret sent to the user's phone is valid for 15 minutes.

A user is limited to 10 active sessions at a time by default. Learn more about session limits.

Rate Limits

This endpoint is limited to 10 requests in every 60 minutes per email address. We use rate limits to avoid service abuse by users and as a security practice. Learn more about rate limiting.

HTTP Request

Name Type Description
userId required string

Unique 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.

phone required string

Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.

HTTP Response

Status Code Content Type Payload
201  Created application/json Token Object
Example Request
  • import { Client, Account } from "appwrite";
    
    const client = new Client();
    
    const account = new Account(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    const promise = account.createPhoneSession('[USER_ID]', '+12065550100');
    
    promise.then(function (response) {
        console.log(response); // Success
    }, function (error) {
        console.log(error); // Failure
    });
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Account account = Account(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
      Future result = account.createPhoneSession(
        userId: '[USER_ID]',
        phone: '+12065550100',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    let account = Account(client)
    
    let token = try await account.createPhoneSession(
        userId: "[USER_ID]",
        phone: "+12065550100"
    )
    
    
  • import io.appwrite.Client
    import io.appwrite.services.Account
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    val account = Account(client)
    
    val response = account.createPhoneSession(
        userId = "[USER_ID]",
        phone = "+12065550100"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Account;
    
    Client client = new Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2"); // Your project ID
    
    Account account = new Account(client);
    
    account.createPhoneSession(
        "[USER_ID]",
        "+12065550100"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            Log.d("Appwrite", result.toString());
        })
    );
    
  • mutation {
        accountCreatePhoneSession(
            userId: "[USER_ID]",
            phone: "+12065550100"
        ) {
            _id
            _createdAt
            userId
            secret
            expire
        }
    }
    
  • POST /v1/account/sessions/phone HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    
    {
      "userId": "[USER_ID]",
      "phone": "+12065550100"
    }
    

Create Phone Session (confirmation)

PUT/v1/account/sessions/phone

Use this endpoint to complete creating a session with SMS. Use the userId from the createPhoneSession endpoint and the secret received via SMS to successfully update and confirm the phone session.

Rate Limits

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

HTTP Request

Name Type Description
userId required string

User ID.

secret required string

Valid verification token.

HTTP Response

Status Code Content Type Payload
200  OK application/json Session Object
Example Request
  • import { Client, Account } from "appwrite";
    
    const client = new Client();
    
    const account = new Account(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    const promise = account.updatePhoneSession('[USER_ID]', '[SECRET]');
    
    promise.then(function (response) {
        console.log(response); // Success
    }, function (error) {
        console.log(error); // Failure
    });
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Account account = Account(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
      Future result = account.updatePhoneSession(
        userId: '[USER_ID]',
        secret: '[SECRET]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    let account = Account(client)
    
    let session = try await account.updatePhoneSession(
        userId: "[USER_ID]",
        secret: "[SECRET]"
    )
    
    
  • import io.appwrite.Client
    import io.appwrite.services.Account
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    val account = Account(client)
    
    val response = account.updatePhoneSession(
        userId = "[USER_ID]",
        secret = "[SECRET]"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Account;
    
    Client client = new Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2"); // Your project ID
    
    Account account = new Account(client);
    
    account.updatePhoneSession(
        "[USER_ID]",
        "[SECRET]"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            Log.d("Appwrite", result.toString());
        })
    );
    
  • mutation {
        accountUpdatePhoneSession(
            userId: "[USER_ID]",
            secret: "[SECRET]"
        ) {
            _id
            _createdAt
            userId
            expire
            provider
            providerUid
            providerAccessToken
            providerAccessTokenExpiry
            providerRefreshToken
            ip
            osCode
            osName
            osVersion
            clientType
            clientCode
            clientName
            clientVersion
            clientEngine
            clientEngineVersion
            deviceName
            deviceBrand
            deviceModel
            countryCode
            countryName
            current
        }
    }
    
  • PUT /v1/account/sessions/phone HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    
    {
      "userId": "[USER_ID]",
      "secret": "[SECRET]"
    }
    

Create Anonymous Session

POST/v1/account/sessions/anonymous

Use this endpoint to allow a new user to register an anonymous account in your project. This route will also create a new session for the user. To allow the new user to convert an anonymous account to a normal account, you need to update its email and password or create an OAuth2 session.

Rate Limits

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

HTTP Response

Status Code Content Type Payload
201  Created application/json Session Object
Example Request
  • import { Client, Account } from "appwrite";
    
    const client = new Client();
    
    const account = new Account(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    const promise = account.createAnonymousSession();
    
    promise.then(function (response) {
        console.log(response); // Success
    }, function (error) {
        console.log(error); // Failure
    });
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Account account = Account(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
      Future result = account.createAnonymousSession();
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    let account = Account(client)
    
    let session = try await account.createAnonymousSession()
    
    
  • import io.appwrite.Client
    import io.appwrite.services.Account
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    val account = Account(client)
    
    val response = account.createAnonymousSession()
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Account;
    
    Client client = new Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2"); // Your project ID
    
    Account account = new Account(client);
    
    account.createAnonymousSession(new CoroutineCallback<>((result, error) -> {
       if (error != null)
            error.printStackTrace();
            return;
        }
    
        Log.d("Appwrite", result.toString());
    }));
    
  • mutation {
        accountCreateAnonymousSession {
            _id
            _createdAt
            userId
            expire
            provider
            providerUid
            providerAccessToken
            providerAccessTokenExpiry
            providerRefreshToken
            ip
            osCode
            osName
            osVersion
            clientType
            clientCode
            clientName
            clientVersion
            clientEngine
            clientEngineVersion
            deviceName
            deviceBrand
            deviceModel
            countryCode
            countryName
            current
        }
    }
    
  • POST /v1/account/sessions/anonymous HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    
    

Create JWT

POST/v1/account/jwt

Use this endpoint to create a JSON Web Token. You can use the resulting JWT to authenticate on behalf of the current user when working with the Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes from its creation and will be invalid if the user will logout in that time frame.

Rate Limits

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

HTTP Response

Status Code Content Type Payload
201  Created application/json JWT Object
Example Request
  • import { Client, Account } from "appwrite";
    
    const client = new Client();
    
    const account = new Account(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    const promise = account.createJWT();
    
    promise.then(function (response) {
        console.log(response); // Success
    }, function (error) {
        console.log(error); // Failure
    });
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Account account = Account(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
      Future result = account.createJWT();
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    let account = Account(client)
    
    let jwt = try await account.createJWT()
    
    
  • import io.appwrite.Client
    import io.appwrite.services.Account
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    val account = Account(client)
    
    val response = account.createJWT()
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Account;
    
    Client client = new Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2"); // Your project ID
    
    Account account = new Account(client);
    
    account.createJWT(new CoroutineCallback<>((result, error) -> {
       if (error != null)
            error.printStackTrace();
            return;
        }
    
        Log.d("Appwrite", result.toString());
    }));
    
  • mutation {
        accountCreateJWT {
            jwt
        }
    }
    
  • POST /v1/account/jwt HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    
    

Get Account

GET/v1/account

Get currently logged in user data as JSON object.

HTTP Response

Status Code Content Type Payload
200  OK application/json User Object
Example Request
  • import { Client, Account } from "appwrite";
    
    const client = new Client();
    
    const account = new Account(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    const promise = account.get();
    
    promise.then(function (response) {
        console.log(response); // Success
    }, function (error) {
        console.log(error); // Failure
    });
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Account account = Account(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
      Future result = account.get();
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    let account = Account(client)
    
    let user = try await account.get()
    
    
  • import io.appwrite.Client
    import io.appwrite.services.Account
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    val account = Account(client)
    
    val response = account.get()
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Account;
    
    Client client = new Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2"); // Your project ID
    
    Account account = new Account(client);
    
    account.get(new CoroutineCallback<>((result, error) -> {
       if (error != null)
            error.printStackTrace();
            return;
        }
    
        Log.d("Appwrite", result.toString());
    }));
    
  • query {
        accountGet {
            _id
            _createdAt
            _updatedAt
            name
            registration
            status
            passwordUpdate
            email
            phone
            emailVerification
            phoneVerification
            prefs {
                data
            }
        }
    }
    
  • GET /v1/account HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
    
    

Get Account Preferences

GET/v1/account/prefs

Get currently logged in user preferences as a key-value object.

HTTP Response

Status Code Content Type Payload
200  OK application/json Preferences Object
Example Request
  • import { Client, Account } from "appwrite";
    
    const client = new Client();
    
    const account = new Account(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    const promise = account.getPrefs();
    
    promise.then(function (response) {
        console.log(response); // Success
    }, function (error) {
        console.log(error); // Failure
    });
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Account account = Account(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
      Future result = account.getPrefs();
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    let account = Account(client)
    
    let preferences = try await account.getPrefs()
    
    
  • import io.appwrite.Client
    import io.appwrite.services.Account
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    val account = Account(client)
    
    val response = account.getPrefs()
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Account;
    
    Client client = new Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2"); // Your project ID
    
    Account account = new Account(client);
    
    account.getPrefs(new CoroutineCallback<>((result, error) -> {
       if (error != null)
            error.printStackTrace();
            return;
        }
    
        Log.d("Appwrite", result.toString());
    }));
    
  • query {
        accountGetPrefs {
            data
        }
    }
    
  • GET /v1/account/prefs HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
    
    

List Sessions

GET/v1/account/sessions

Get currently logged in user list of active sessions across different devices.

HTTP Response

Status Code Content Type Payload
200  OK application/json Sessions List Object
Example Request
  • import { Client, Account } from "appwrite";
    
    const client = new Client();
    
    const account = new Account(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    const promise = account.listSessions();
    
    promise.then(function (response) {
        console.log(response); // Success
    }, function (error) {
        console.log(error); // Failure
    });
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Account account = Account(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
      Future result = account.listSessions();
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    let account = Account(client)
    
    let sessionList = try await account.listSessions()
    
    
  • import io.appwrite.Client
    import io.appwrite.services.Account
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    val account = Account(client)
    
    val response = account.listSessions()
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Account;
    
    Client client = new Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2"); // Your project ID
    
    Account account = new Account(client);
    
    account.listSessions(new CoroutineCallback<>((result, error) -> {
       if (error != null)
            error.printStackTrace();
            return;
        }
    
        Log.d("Appwrite", result.toString());
    }));
    
  • query {
        accountListSessions {
            total
            sessions {
                _id
                _createdAt
                userId
                expire
                provider
                providerUid
                providerAccessToken
                providerAccessTokenExpiry
                providerRefreshToken
                ip
                osCode
                osName
                osVersion
                clientType
                clientCode
                clientName
                clientVersion
                clientEngine
                clientEngineVersion
                deviceName
                deviceBrand
                deviceModel
                countryCode
                countryName
                current
            }
        }
    }
    
  • GET /v1/account/sessions HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
    
    

List Logs

GET/v1/account/logs

Get currently logged in user list of latest security activity logs. Each log returns user IP address, location and date and time of log.

HTTP Request

Name Type Description
queries optional array

Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Only supported methods are limit and offset

HTTP Response

Status Code Content Type Payload
200  OK application/json Logs List Object
Example Request
  • import { Client, Account } from "appwrite";
    
    const client = new Client();
    
    const account = new Account(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    const promise = account.listLogs();
    
    promise.then(function (response) {
        console.log(response); // Success
    }, function (error) {
        console.log(error); // Failure
    });
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Account account = Account(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
      Future result = account.listLogs(
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    let account = Account(client)
    
    let logList = try await account.listLogs()
    
    
  • import io.appwrite.Client
    import io.appwrite.services.Account
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    val account = Account(client)
    
    val response = account.listLogs(
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Account;
    
    Client client = new Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2"); // Your project ID
    
    Account account = new Account(client);
    
    account.listLogs(
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            Log.d("Appwrite", result.toString());
        })
    );
    
  • query {
        accountListLogs {
            total
            logs {
                event
                userId
                userEmail
                userName
                mode
                ip
                time
                osCode
                osName
                osVersion
                clientType
                clientCode
                clientName
                clientVersion
                clientEngine
                clientEngineVersion
                deviceName
                deviceBrand
                deviceModel
                countryCode
                countryName
            }
        }
    }
    
  • GET /v1/account/logs HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
    
    

Get Session

GET/v1/account/sessions/{sessionId}

Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used.

HTTP Request

Name Type Description
sessionId required string

Session ID. Use the string 'current' to get the current device session.

HTTP Response

Status Code Content Type Payload
200  OK application/json Session Object
Example Request
  • import { Client, Account } from "appwrite";
    
    const client = new Client();
    
    const account = new Account(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    const promise = account.getSession('[SESSION_ID]');
    
    promise.then(function (response) {
        console.log(response); // Success
    }, function (error) {
        console.log(error); // Failure
    });
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Account account = Account(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
      Future result = account.getSession(
        sessionId: '[SESSION_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    let account = Account(client)
    
    let session = try await account.getSession(
        sessionId: "[SESSION_ID]"
    )
    
    
  • import io.appwrite.Client
    import io.appwrite.services.Account
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    val account = Account(client)
    
    val response = account.getSession(
        sessionId = "[SESSION_ID]"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Account;
    
    Client client = new Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2"); // Your project ID
    
    Account account = new Account(client);
    
    account.getSession(
        "[SESSION_ID]"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            Log.d("Appwrite", result.toString());
        })
    );
    
  • query {
        accountGetSession(
            sessionId: "[SESSION_ID]"
        ) {
            _id
            _createdAt
            userId
            expire
            provider
            providerUid
            providerAccessToken
            providerAccessTokenExpiry
            providerRefreshToken
            ip
            osCode
            osName
            osVersion
            clientType
            clientCode
            clientName
            clientVersion
            clientEngine
            clientEngineVersion
            deviceName
            deviceBrand
            deviceModel
            countryCode
            countryName
            current
        }
    }
    
  • GET /v1/account/sessions/{sessionId} HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
    
    

Update Name

PATCH/v1/account/name

Update currently logged in user account name.

HTTP Request

Name Type Description
name required string

User name. Max length: 128 chars.

HTTP Response

Status Code Content Type Payload
200  OK application/json User Object
Example Request
  • import { Client, Account } from "appwrite";
    
    const client = new Client();
    
    const account = new Account(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    const promise = account.updateName('[NAME]');
    
    promise.then(function (response) {
        console.log(response); // Success
    }, function (error) {
        console.log(error); // Failure
    });
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Account account = Account(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
      Future result = account.updateName(
        name: '[NAME]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    let account = Account(client)
    
    let user = try await account.updateName(
        name: "[NAME]"
    )
    
    
  • import io.appwrite.Client
    import io.appwrite.services.Account
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    val account = Account(client)
    
    val response = account.updateName(
        name = "[NAME]"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Account;
    
    Client client = new Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2"); // Your project ID
    
    Account account = new Account(client);
    
    account.updateName(
        "[NAME]"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            Log.d("Appwrite", result.toString());
        })
    );
    
  • mutation {
        accountUpdateName(
            name: "[NAME]"
        ) {
            _id
            _createdAt
            _updatedAt
            name
            registration
            status
            passwordUpdate
            email
            phone
            emailVerification
            phoneVerification
            prefs {
                data
            }
        }
    }
    
  • PATCH /v1/account/name HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
    
    {
      "name": "[NAME]"
    }
    

Update Password

PATCH/v1/account/password

Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth, Team Invites and Magic URL, oldPassword is optional.

HTTP Request

Name Type Description
password required string

New user password. Must be at least 8 chars.

oldPassword optional string

Current user password. Must be at least 8 chars.

HTTP Response

Status Code Content Type Payload
200  OK application/json User Object
Example Request
  • import { Client, Account } from "appwrite";
    
    const client = new Client();
    
    const account = new Account(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    const promise = account.updatePassword('');
    
    promise.then(function (response) {
        console.log(response); // Success
    }, function (error) {
        console.log(error); // Failure
    });
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Account account = Account(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
      Future result = account.updatePassword(
        password: '',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    let account = Account(client)
    
    let user = try await account.updatePassword(
        password: ""
    )
    
    
  • import io.appwrite.Client
    import io.appwrite.services.Account
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    val account = Account(client)
    
    val response = account.updatePassword(
        password = "",
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Account;
    
    Client client = new Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2"); // Your project ID
    
    Account account = new Account(client);
    
    account.updatePassword(
        "",
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            Log.d("Appwrite", result.toString());
        })
    );
    
  • mutation {
        accountUpdatePassword(
            password: ""
        ) {
            _id
            _createdAt
            _updatedAt
            name
            registration
            status
            passwordUpdate
            email
            phone
            emailVerification
            phoneVerification
            prefs {
                data
            }
        }
    }
    
  • PATCH /v1/account/password HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
    
    {
      "password": ,
      "oldPassword": "password"
    }
    

Update Email

PATCH/v1/account/email

Update currently logged in user account email address. After changing user address, the user confirmation status will get reset. A new confirmation email is not sent automatically however you can use the send confirmation email endpoint again to send the confirmation email. For security measures, user password is required to complete this request. This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password.

HTTP Request

Name Type Description
email required string

User email.

password required string

User password. Must be at least 8 chars.

HTTP Response

Status Code Content Type Payload
200  OK application/json User Object
Example Request
  • import { Client, Account } from "appwrite";
    
    const client = new Client();
    
    const account = new Account(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    const promise = account.updateEmail('email@example.com', 'password');
    
    promise.then(function (response) {
        console.log(response); // Success
    }, function (error) {
        console.log(error); // Failure
    });
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Account account = Account(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
      Future result = account.updateEmail(
        email: 'email@example.com',
        password: 'password',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    let account = Account(client)
    
    let user = try await account.updateEmail(
        email: "email@example.com",
        password: "password"
    )
    
    
  • import io.appwrite.Client
    import io.appwrite.services.Account
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    val account = Account(client)
    
    val response = account.updateEmail(
        email = "email@example.com",
        password = "password"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Account;
    
    Client client = new Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2"); // Your project ID
    
    Account account = new Account(client);
    
    account.updateEmail(
        "email@example.com",
        "password"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            Log.d("Appwrite", result.toString());
        })
    );
    
  • mutation {
        accountUpdateEmail(
            email: "email@example.com",
            password: "password"
        ) {
            _id
            _createdAt
            _updatedAt
            name
            registration
            status
            passwordUpdate
            email
            phone
            emailVerification
            phoneVerification
            prefs {
                data
            }
        }
    }
    
  • PATCH /v1/account/email HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
    
    {
      "email": "email@example.com",
      "password": "password"
    }
    

Update Phone

PATCH/v1/account/phone

Update the currently logged in user's phone number. After updating the phone number, the phone verification status will be reset. A confirmation SMS is not sent automatically, however you can use the POST /account/verification/phone endpoint to send a confirmation SMS.

HTTP Request

Name Type Description
phone required string

Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.

password required string

User password. Must be at least 8 chars.

HTTP Response

Status Code Content Type Payload
200  OK application/json User Object
Example Request
  • import { Client, Account } from "appwrite";
    
    const client = new Client();
    
    const account = new Account(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    const promise = account.updatePhone('+12065550100', 'password');
    
    promise.then(function (response) {
        console.log(response); // Success
    }, function (error) {
        console.log(error); // Failure
    });
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Account account = Account(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
      Future result = account.updatePhone(
        phone: '+12065550100',
        password: 'password',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    let account = Account(client)
    
    let user = try await account.updatePhone(
        phone: "+12065550100",
        password: "password"
    )
    
    
  • import io.appwrite.Client
    import io.appwrite.services.Account
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    val account = Account(client)
    
    val response = account.updatePhone(
        phone = "+12065550100",
        password = "password"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Account;
    
    Client client = new Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2"); // Your project ID
    
    Account account = new Account(client);
    
    account.updatePhone(
        "+12065550100",
        "password"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            Log.d("Appwrite", result.toString());
        })
    );
    
  • mutation {
        accountUpdatePhone(
            phone: "+12065550100",
            password: "password"
        ) {
            _id
            _createdAt
            _updatedAt
            name
            registration
            status
            passwordUpdate
            email
            phone
            emailVerification
            phoneVerification
            prefs {
                data
            }
        }
    }
    
  • PATCH /v1/account/phone HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
    
    {
      "phone": "+12065550100",
      "password": "password"
    }
    

Update Preferences

PATCH/v1/account/prefs

Update currently logged in user account preferences. 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.

HTTP Request

Name Type Description
prefs required object

Prefs key-value JSON object.

HTTP Response

Status Code Content Type Payload
200  OK application/json User Object
Example Request
  • import { Client, Account } from "appwrite";
    
    const client = new Client();
    
    const account = new Account(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    const promise = account.updatePrefs({});
    
    promise.then(function (response) {
        console.log(response); // Success
    }, function (error) {
        console.log(error); // Failure
    });
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Account account = Account(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
      Future result = account.updatePrefs(
        prefs: {},
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    let account = Account(client)
    
    let user = try await account.updatePrefs(
        prefs: [:]
    )
    
    
  • import io.appwrite.Client
    import io.appwrite.services.Account
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    val account = Account(client)
    
    val response = account.updatePrefs(
        prefs = mapOf( "a" to "b" )
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Account;
    
    Client client = new Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2"); // Your project ID
    
    Account account = new Account(client);
    
    account.updatePrefs(
        mapOf( "a" to "b" )
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            Log.d("Appwrite", result.toString());
        })
    );
    
  • mutation {
        accountUpdatePrefs(
            prefs: "{}"
        ) {
            _id
            _createdAt
            _updatedAt
            name
            registration
            status
            passwordUpdate
            email
            phone
            emailVerification
            phoneVerification
            prefs {
                data
            }
        }
    }
    
  • PATCH /v1/account/prefs HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
    
    {
      "prefs": {}
    }
    

Update Status

PATCH/v1/account/status

Block the currently logged in user account. Behind the scene, the user record is not deleted but permanently blocked from any access. To completely delete a user, use the Users API instead.

HTTP Response

Status Code Content Type Payload
200  OK application/json User Object
Example Request
  • import { Client, Account } from "appwrite";
    
    const client = new Client();
    
    const account = new Account(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    const promise = account.updateStatus();
    
    promise.then(function (response) {
        console.log(response); // Success
    }, function (error) {
        console.log(error); // Failure
    });
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Account account = Account(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
      Future result = account.updateStatus();
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    let account = Account(client)
    
    let user = try await account.updateStatus()
    
    
  • import io.appwrite.Client
    import io.appwrite.services.Account
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    val account = Account(client)
    
    val response = account.updateStatus()
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Account;
    
    Client client = new Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2"); // Your project ID
    
    Account account = new Account(client);
    
    account.updateStatus(new CoroutineCallback<>((result, error) -> {
       if (error != null)
            error.printStackTrace();
            return;
        }
    
        Log.d("Appwrite", result.toString());
    }));
    
  • mutation {
        accountUpdateStatus {
            _id
            _createdAt
            _updatedAt
            name
            registration
            status
            passwordUpdate
            email
            phone
            emailVerification
            phoneVerification
            prefs {
                data
            }
        }
    }
    
  • PATCH /v1/account/status HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
    
    

Delete Session

DELETE/v1/account/sessions/{sessionId}

Use this endpoint to log out the currently logged in user from all their account sessions across all of their different devices. When using the Session ID argument, only the unique session ID provided is deleted.

Rate Limits

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

HTTP Request

Name Type Description
sessionId required string

Session ID. Use the string 'current' to delete the current device session.

HTTP Response

Status Code Content Type Payload
204  No Content - -
Example Request
  • import { Client, Account } from "appwrite";
    
    const client = new Client();
    
    const account = new Account(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    const promise = account.deleteSession('[SESSION_ID]');
    
    promise.then(function (response) {
        console.log(response); // Success
    }, function (error) {
        console.log(error); // Failure
    });
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Account account = Account(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
      Future result = account.deleteSession(
        sessionId: '[SESSION_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    let account = Account(client)
    
    let result = try await account.deleteSession(
        sessionId: "[SESSION_ID]"
    )
    
    
  • import io.appwrite.Client
    import io.appwrite.services.Account
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    val account = Account(client)
    
    val response = account.deleteSession(
        sessionId = "[SESSION_ID]"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Account;
    
    Client client = new Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2"); // Your project ID
    
    Account account = new Account(client);
    
    account.deleteSession(
        "[SESSION_ID]"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            Log.d("Appwrite", result.toString());
        })
    );
    
  • mutation {
        accountDeleteSession(
            sessionId: "[SESSION_ID]"
        ) {
            status
        }
    }
    
  • DELETE /v1/account/sessions/{sessionId} HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
    
    

Update OAuth Session (Refresh Tokens)

PATCH/v1/account/sessions/{sessionId}

Access tokens have limited lifespan and expire to mitigate security risks. If session was created using an OAuth provider, this route can be used to "refresh" the access token.

Rate Limits

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

HTTP Request

Name Type Description
sessionId required string

Session ID. Use the string 'current' to update the current device session.

HTTP Response

Status Code Content Type Payload
200  OK application/json Session Object
Example Request
  • import { Client, Account } from "appwrite";
    
    const client = new Client();
    
    const account = new Account(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    const promise = account.updateSession('[SESSION_ID]');
    
    promise.then(function (response) {
        console.log(response); // Success
    }, function (error) {
        console.log(error); // Failure
    });
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Account account = Account(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
      Future result = account.updateSession(
        sessionId: '[SESSION_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    let account = Account(client)
    
    let session = try await account.updateSession(
        sessionId: "[SESSION_ID]"
    )
    
    
  • import io.appwrite.Client
    import io.appwrite.services.Account
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    val account = Account(client)
    
    val response = account.updateSession(
        sessionId = "[SESSION_ID]"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Account;
    
    Client client = new Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2"); // Your project ID
    
    Account account = new Account(client);
    
    account.updateSession(
        "[SESSION_ID]"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            Log.d("Appwrite", result.toString());
        })
    );
    
  • mutation {
        accountUpdateSession(
            sessionId: "[SESSION_ID]"
        ) {
            _id
            _createdAt
            userId
            expire
            provider
            providerUid
            providerAccessToken
            providerAccessTokenExpiry
            providerRefreshToken
            ip
            osCode
            osName
            osVersion
            clientType
            clientCode
            clientName
            clientVersion
            clientEngine
            clientEngineVersion
            deviceName
            deviceBrand
            deviceModel
            countryCode
            countryName
            current
        }
    }
    
  • PATCH /v1/account/sessions/{sessionId} HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
    
    

Delete Sessions

DELETE/v1/account/sessions

Delete all sessions from the user account and remove any sessions cookies from the end client.

Rate Limits

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

HTTP Response

Status Code Content Type Payload
204  No Content - -
Example Request
  • import { Client, Account } from "appwrite";
    
    const client = new Client();
    
    const account = new Account(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    const promise = account.deleteSessions();
    
    promise.then(function (response) {
        console.log(response); // Success
    }, function (error) {
        console.log(error); // Failure
    });
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Account account = Account(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
      Future result = account.deleteSessions();
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    let account = Account(client)
    
    let result = try await account.deleteSessions()
    
    
  • import io.appwrite.Client
    import io.appwrite.services.Account
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    val account = Account(client)
    
    val response = account.deleteSessions()
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Account;
    
    Client client = new Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2"); // Your project ID
    
    Account account = new Account(client);
    
    account.deleteSessions(new CoroutineCallback<>((result, error) -> {
       if (error != null)
            error.printStackTrace();
            return;
        }
    
        Log.d("Appwrite", result.toString());
    }));
    
  • mutation {
        accountDeleteSessions {
            status
        }
    }
    
  • DELETE /v1/account/sessions HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
    
    

Create Password Recovery

POST/v1/account/recovery

Sends the user an email with a temporary secret key for password reset. When the user clicks the confirmation link he is redirected back to your app password reset URL with the secret key and email address values attached to the URL query string. Use the query string params to submit a request to the PUT /account/recovery endpoint to complete the process. The verification link sent to the user's email address is valid for 1 hour.

Rate Limits

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

HTTP Request

Name Type Description
email required string

User email.

url required string

URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an open redirect attack against your project API.

HTTP Response

Status Code Content Type Payload
201  Created application/json Token Object
Example Request
  • import { Client, Account } from "appwrite";
    
    const client = new Client();
    
    const account = new Account(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    const promise = account.createRecovery('email@example.com', 'https://example.com');
    
    promise.then(function (response) {
        console.log(response); // Success
    }, function (error) {
        console.log(error); // Failure
    });
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Account account = Account(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
      Future result = account.createRecovery(
        email: 'email@example.com',
        url: 'https://example.com',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    let account = Account(client)
    
    let token = try await account.createRecovery(
        email: "email@example.com",
        url: "https://example.com"
    )
    
    
  • import io.appwrite.Client
    import io.appwrite.services.Account
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    val account = Account(client)
    
    val response = account.createRecovery(
        email = "email@example.com",
        url = "https://example.com"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Account;
    
    Client client = new Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2"); // Your project ID
    
    Account account = new Account(client);
    
    account.createRecovery(
        "email@example.com",
        "https://example.com"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            Log.d("Appwrite", result.toString());
        })
    );
    
  • mutation {
        accountCreateRecovery(
            email: "email@example.com",
            url: "https://example.com"
        ) {
            _id
            _createdAt
            userId
            secret
            expire
        }
    }
    
  • POST /v1/account/recovery HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
    
    {
      "email": "email@example.com",
      "url": "https://example.com"
    }
    

Create Password Recovery (confirmation)

PUT/v1/account/recovery

Use this endpoint to complete the user account password reset. Both the userId and secret arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the POST /account/recovery endpoint.

Please note that in order to avoid a Redirect Attack the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.

Rate Limits

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

HTTP Request

Name Type Description
userId required string

User ID.

secret required string

Valid reset token.

password required string

New user password. Must be at least 8 chars.

passwordAgain required string

Repeat new user password. Must be at least 8 chars.

HTTP Response

Status Code Content Type Payload
200  OK application/json Token Object
Example Request
  • import { Client, Account } from "appwrite";
    
    const client = new Client();
    
    const account = new Account(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    const promise = account.updateRecovery('[USER_ID]', '[SECRET]', 'password', 'password');
    
    promise.then(function (response) {
        console.log(response); // Success
    }, function (error) {
        console.log(error); // Failure
    });
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Account account = Account(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
      Future result = account.updateRecovery(
        userId: '[USER_ID]',
        secret: '[SECRET]',
        password: 'password',
        passwordAgain: 'password',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    let account = Account(client)
    
    let token = try await account.updateRecovery(
        userId: "[USER_ID]",
        secret: "[SECRET]",
        password: "password",
        passwordAgain: "password"
    )
    
    
  • import io.appwrite.Client
    import io.appwrite.services.Account
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    val account = Account(client)
    
    val response = account.updateRecovery(
        userId = "[USER_ID]",
        secret = "[SECRET]",
        password = "password",
        passwordAgain = "password"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Account;
    
    Client client = new Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2"); // Your project ID
    
    Account account = new Account(client);
    
    account.updateRecovery(
        "[USER_ID]",
        "[SECRET]",
        "password",
        "password"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            Log.d("Appwrite", result.toString());
        })
    );
    
  • mutation {
        accountUpdateRecovery(
            userId: "[USER_ID]",
            secret: "[SECRET]",
            password: "password",
            passwordAgain: "password"
        ) {
            _id
            _createdAt
            userId
            secret
            expire
        }
    }
    
  • PUT /v1/account/recovery HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
    
    {
      "userId": "[USER_ID]",
      "secret": "[SECRET]",
      "password": "password",
      "passwordAgain": "password"
    }
    

Create Email Verification

POST/v1/account/verification

Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the userId and secret arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the userId and secret parameters. Learn more about how to complete the verification process. The verification link sent to the user's email address is valid for 7 days.

Please note that in order to avoid a Redirect Attack, the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.

Rate Limits

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

HTTP Request

Name Type Description
url required string

URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an open redirect attack against your project API.

HTTP Response

Status Code Content Type Payload
201  Created application/json Token Object
Example Request
  • import { Client, Account } from "appwrite";
    
    const client = new Client();
    
    const account = new Account(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    const promise = account.createVerification('https://example.com');
    
    promise.then(function (response) {
        console.log(response); // Success
    }, function (error) {
        console.log(error); // Failure
    });
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Account account = Account(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
      Future result = account.createVerification(
        url: 'https://example.com',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    let account = Account(client)
    
    let token = try await account.createVerification(
        url: "https://example.com"
    )
    
    
  • import io.appwrite.Client
    import io.appwrite.services.Account
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    val account = Account(client)
    
    val response = account.createVerification(
        url = "https://example.com"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Account;
    
    Client client = new Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2"); // Your project ID
    
    Account account = new Account(client);
    
    account.createVerification(
        "https://example.com"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            Log.d("Appwrite", result.toString());
        })
    );
    
  • mutation {
        accountCreateVerification(
            url: "https://example.com"
        ) {
            _id
            _createdAt
            userId
            secret
            expire
        }
    }
    
  • POST /v1/account/verification HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
    
    {
      "url": "https://example.com"
    }
    

Create Email Verification (confirmation)

PUT/v1/account/verification

Use this endpoint to complete the user email verification process. Use both the userId and secret parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code.

Rate Limits

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

HTTP Request

Name Type Description
userId required string

User ID.

secret required string

Valid verification token.

HTTP Response

Status Code Content Type Payload
200  OK application/json Token Object
Example Request
  • import { Client, Account } from "appwrite";
    
    const client = new Client();
    
    const account = new Account(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    const promise = account.updateVerification('[USER_ID]', '[SECRET]');
    
    promise.then(function (response) {
        console.log(response); // Success
    }, function (error) {
        console.log(error); // Failure
    });
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Account account = Account(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
      Future result = account.updateVerification(
        userId: '[USER_ID]',
        secret: '[SECRET]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    let account = Account(client)
    
    let token = try await account.updateVerification(
        userId: "[USER_ID]",
        secret: "[SECRET]"
    )
    
    
  • import io.appwrite.Client
    import io.appwrite.services.Account
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    val account = Account(client)
    
    val response = account.updateVerification(
        userId = "[USER_ID]",
        secret = "[SECRET]"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Account;
    
    Client client = new Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2"); // Your project ID
    
    Account account = new Account(client);
    
    account.updateVerification(
        "[USER_ID]",
        "[SECRET]"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            Log.d("Appwrite", result.toString());
        })
    );
    
  • mutation {
        accountUpdateVerification(
            userId: "[USER_ID]",
            secret: "[SECRET]"
        ) {
            _id
            _createdAt
            userId
            secret
            expire
        }
    }
    
  • PUT /v1/account/verification HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
    
    {
      "userId": "[USER_ID]",
      "secret": "[SECRET]"
    }
    

Create Phone Verification

POST/v1/account/verification/phone

Use this endpoint to send a verification SMS to the currently logged in user. This endpoint is meant for use after updating a user's phone number using the accountUpdatePhone endpoint. Learn more about how to complete the verification process. The verification code sent to the user's phone number is valid for 15 minutes.

Rate Limits

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

HTTP Response

Status Code Content Type Payload
201  Created application/json Token Object
Example Request
  • import { Client, Account } from "appwrite";
    
    const client = new Client();
    
    const account = new Account(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    const promise = account.createPhoneVerification();
    
    promise.then(function (response) {
        console.log(response); // Success
    }, function (error) {
        console.log(error); // Failure
    });
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Account account = Account(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
      Future result = account.createPhoneVerification();
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    let account = Account(client)
    
    let token = try await account.createPhoneVerification()
    
    
  • import io.appwrite.Client
    import io.appwrite.services.Account
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    val account = Account(client)
    
    val response = account.createPhoneVerification()
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Account;
    
    Client client = new Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2"); // Your project ID
    
    Account account = new Account(client);
    
    account.createPhoneVerification(new CoroutineCallback<>((result, error) -> {
       if (error != null)
            error.printStackTrace();
            return;
        }
    
        Log.d("Appwrite", result.toString());
    }));
    
  • mutation {
        accountCreatePhoneVerification {
            _id
            _createdAt
            userId
            secret
            expire
        }
    }
    
  • POST /v1/account/verification/phone HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
    
    

Create Phone Verification (confirmation)

PUT/v1/account/verification/phone

Use this endpoint to complete the user phone verification process. Use the userId and secret that were sent to your user's phone number to verify the user email ownership. If confirmed this route will return a 200 status code.

Rate Limits

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

HTTP Request

Name Type Description
userId required string

User ID.

secret required string

Valid verification token.

HTTP Response

Status Code Content Type Payload
200  OK application/json Token Object
Example Request
  • import { Client, Account } from "appwrite";
    
    const client = new Client();
    
    const account = new Account(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    const promise = account.updatePhoneVerification('[USER_ID]', '[SECRET]');
    
    promise.then(function (response) {
        console.log(response); // Success
    }, function (error) {
        console.log(error); // Failure
    });
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Account account = Account(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
      Future result = account.updatePhoneVerification(
        userId: '[USER_ID]',
        secret: '[SECRET]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    let account = Account(client)
    
    let token = try await account.updatePhoneVerification(
        userId: "[USER_ID]",
        secret: "[SECRET]"
    )
    
    
  • import io.appwrite.Client
    import io.appwrite.services.Account
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    val account = Account(client)
    
    val response = account.updatePhoneVerification(
        userId = "[USER_ID]",
        secret = "[SECRET]"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Account;
    
    Client client = new Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2"); // Your project ID
    
    Account account = new Account(client);
    
    account.updatePhoneVerification(
        "[USER_ID]",
        "[SECRET]"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            Log.d("Appwrite", result.toString());
        })
    );
    
  • mutation {
        accountUpdatePhoneVerification(
            userId: "[USER_ID]",
            secret: "[SECRET]"
        ) {
            _id
            _createdAt
            userId
            secret
            expire
        }
    }
    
  • PUT /v1/account/verification/phone HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
    
    {
      "userId": "[USER_ID]",
      "secret": "[SECRET]"
    }