Commands

CLI Version

All commands are compatible with the latest version of the CLI. We recommend running the CLI on its latest version.

Other than commands to create and push databases, collections, functions, messaging-topics, teams, and buckets, the Appwrite CLI can be used as a Server SDK as well. The Appwrite CLI has a command for every Server API endpoint.

Commands generally follow the following syntax:

Shell
appwrite [COMMAND] [OPTIONS]

Commands

Below is a list of the available commands in the Appwrite CLI. You can get more information on each command by running appwrite [COMMAND] --help.

General commands

CommandDescription
assistantThe assistant command allows you to interact with the Appwrite Assistant AI.
client [options]The client command allows you to configure your CLI.
localeThe locale command allows you to customize your app based on your users' location.
graphqlThe graphql command allows you to query and mutate any resource type on your Appwrite server.

Account commands

CommandDescription
login [options]The login command allows you to authenticate into the CLI. This command expects the console account that you use to log into the Appwrite Console.
logoutThe logout command allows you to log out of your Appwrite account.
registerPrints link to register an Appwrite account.
whoamiThe whomai command gives information about the currently logged-in user.

Deployment commands

CommandDescription
init [options]The init command provides a convenient wrapper for creating and initializing projects, functions, collections, buckets, teams, and messaging-topics in Appwrite.
pullThe pull command helps you pull your Appwrite project, functions, collections, buckets, teams, and messaging-topics.
pushThe push command provides a convenient wrapper for pushing your functions, collections, buckets, teams, and topics.
runThe run command allows you to run projects locally to allow easy development and quick debugging.

Project commands

CommandDescription
accountThe account command allows you to authenticate and manage a user account.
usersThe users command allows you to manage your project users.
teamsThe teams command allows you to group users of your project and enable them to share read and write access to your project resources.
databasesThe databases command allows you to create structured collections of documents and query and filter lists of documents.
functionsThe functions command allows you to view, create, and manage your Appwrite Functions.
messagingThe messaging command allows you to send, create, edit, and delete messages.
storageThe storage command allows you to manage your project files.
avatarsThe avatars command provides utilities to manage images, icons, and avatars.

Command options

CommandDescription
-v, --versionOutput the version number
-V, --verboseShow complete error log
-j, --jsonOutput in JSON format
-f,--forceFlag to confirm all warnings
-a,--allFlag to push all resources
--id [id...]Flag to pass a list of ids for a given action
--reportEnable reporting in case of CLI errors
-h, --helpDisplay help for command

Verbose

In case of errors with any command, you can get more information about what went wrong using the --verbose flag

Shell
appwrite users list --verbose

JSON

By default, output is rendered in a tabular format. To format the output as JSON, use the --json flag.

Shell
appwrite users list --json

Force

By default, when pushing or pulling resources, the Appwrite CLI will ask you to confirm destructive operations. Use the --force flag to verify all questions.

Shell
appwrite push collections --force

All

By default, when pushing or pulling resources, Appwrite CLI would ask you to select specific resources. Use the --all flag to select all available options.

Shell
appwrite pull functions --all

Error reporting

If you encounter errors with any command, you can use the --report flag to generate a GitHub reporting link.

Shell
appwrite login --report

View on console

Many resources support the option to view them in the console. Use the --console flag to get a direct link to the console, and add the optional --open flag to automatically open it in the default browser.

Shell
appwrite databases get-document \
  --database-id "<DATABASE_ID>" \
  --collection-id "<COLLECTION_ID>" \
  --document-id "<DOCUMENT_ID>" \
  --console --open

Examples

Create user

To create a new user in your project, you can use the create command.

Shell
appwrite users create --user-id "unique()" \
    --email [email protected] \
    --password very_strong_password

List users

To get a list of all your project users, you can use the list command.

Shell
appwrite users list

List collections

To get a list of all your collections, you can use the list-collections command.

Shell
appwrite databases list-collections --database-id "<DATABASE_ID>"

If you wish to parse the output from the CLI, you can request the CLI output in JSON format using the --json flag

Shell
appwrite databases list-collections --database-id "<DATABASE_ID>" --json

Get collection

To get more information on a particular collection, you can make use of the get-collection command and pass in the collection-id.

Shell
appwrite databases get-collection --database-id "<DATABASE_ID>" --collection-id "<COLLECTION_ID>"

Create document

To create a new document in an existing collection, use the create-document command.

Shell
appwrite databases create-document \
    --database-id "<DATABASE_ID>" --collection-id "<COLLECTION_ID>" \
    --document-id 'unique()' --data '{ "Name": "Iron Man" }' \
    --permissions 'read("any")' 'write("team:abc")'