Commands

Other than commands to create and deploy databases, collections, functions, 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 follows the following general syntax:

Shell
appwrite [COMMAND] [OPTIONS]

List

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.

CommandDescription
loginThe login command allows you to authenticate into the CLI. This command expects the console account that you use to log into the Appwrite Console.
clientThe client command allows you to configure your CLI.
initThe init command helps you initialize your Appwrite project, databases, collections, functions, teams, and buckets.
deployThe deploy command provides a convenient wrapper for deploying your databases, collections, functions, teams, and buckets.
logoutThe logout command allows you to logout from the CLI.
projectsThe projects command allows you to view, create, and manage your Appwrite projects.
storageThe storage command allows you to manage your project files.
teamsThe teams command allows you to group users of your project and to enable them to share access permissions to your project's resources.
usersThe users command allows you to manage your project users.
accountThe account command allows you to authenticate as and manage a user account.
avatarsThe avatars command provides utilities to manage images, icons, and avatars.
functionsThe functions command allows you view, create and manage your Appwrite Functions.
databasesThe databases command allows you to create structured collections of documents, query and filter lists of documents.
localeThe locale command allows you to customize your app based on your users' location.

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

Examples

Create user

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

Shell
appwrite users create --userId "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.

Shell
appwrite users list

List collections

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

Shell
appwrite databases listCollections --databaseId [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 listCollections --databaseId [DATABASE_ID]--json

Get collection

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

Shell
appwrite databases getCollection --databaseId [DATABASE_ID] --collectionId [COLLECTION_ID]

Create document

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

Shell
appwrite databases createDocument \
    --databaseId [DATABASE_ID] --collectionId [COLLECTION_ID] \
    --documentId 'unique()' --data '{ "Name": "Iron Man" }' \
    --permissions 'read("any")' 'write("team:abc")'