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:
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
Command | Description |
assistant | The assistant command allows you to interact with the Appwrite Assistant AI. |
client [options] | The client command allows you to configure your CLI. |
locale | The locale command allows you to customize your app based on your users' location. |
graphql | The graphql command allows you to query and mutate any resource type on your Appwrite server. |
Account commands
Command | Description |
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. |
logout | The logout command allows you to log out of your Appwrite account. |
register | Prints link to register an Appwrite account. |
whoami | The whomai command gives information about the currently logged-in user. |
Deployment commands
Command | Description |
init [options] | The init command provides a convenient wrapper for creating and initializing projects, functions, collections, buckets, teams, and messaging-topics in Appwrite. |
pull | The pull command helps you pull your Appwrite project, functions, collections, buckets, teams, and messaging-topics. |
push | The push command provides a convenient wrapper for pushing your functions, collections, buckets, teams, and topics. |
run | The run command allows you to run projects locally to allow easy development and quick debugging. |
Project commands
Command | Description |
account | The account command allows you to authenticate and manage a user account. |
users | The users command allows you to manage your project users. |
teams | The teams command allows you to group users of your project and enable them to share read and write access to your project resources. |
databases | The databases command allows you to create structured collections of documents and query and filter lists of documents. |
functions | The functions command allows you to view, create, and manage your Appwrite Functions. |
messaging | The messaging command allows you to send, create, edit, and delete messages. |
storage | The storage command allows you to manage your project files. |
avatars | The avatars command provides utilities to manage images, icons, and avatars. |
Command options
Command | Description |
-v, --version | Output the version number |
-V, --verbose | Show complete error log |
-j, --json | Output in JSON format |
-f,--force | Flag to confirm all warnings |
-a,--all | Flag to push all resources |
--id [id...] | Flag to pass a list of ids for a given action |
--report | Enable reporting in case of CLI errors |
-h, --help | Display help for command |
Verbose
In case of errors with any command, you can get more information about what went wrong using the --verbose flag
appwrite users list --verbose
JSON
By default, output is rendered in a tabular format. To format the output as JSON, use the --json flag.
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.
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.
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.
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.
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.
appwrite users create --user-id "unique()" \
--email hello@appwrite.io \
--password very_strong_password
List users
To get a list of all your project users, you can use the list command.
appwrite users list
List collections
To get a list of all your collections, you can use the list-collections command.
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
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.
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.
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")'